[net.news.b] 2.10.1 inews munges line counts

ado@elsie.UUCP (Arthur David Olson) (08/02/85)

Sites running distributed 2.10.1 news software have a bug in "inews" that
causes article line counts to be wrong.  2.10.1 "inews" strips trailing blank
lines from articles, but fails to change the "Lines:" header line in affected
articles.  The fix, as extracted from later versions of the news software,
follows.  In the file "inews.c", and particularly in the function "input",
find the lines that read something like. . .

	if (header.numlines[0]) {
		/*
		 * Check line count if there's already one attached to
		 * the article.  Could make this a fatal error -
		 * throwing it away if it got chopped, in hopes that
		 * another copy will come in later with a correct
		 * line count.  But that seems a bit much for now.
		 */
		if (linecount != header.intnumlines)
			log("linecount expected %d, got %d\n", header.intnumlines, linecount);
	} else {
		/* Attach a line count to the article. */
		header.intnumlines = linecount;
		sprintf(header.numlines, "%d", linecount);
	}

. . .and add the lines (conditionally compiled on OLDVERSION) shown below:

	if (header.numlines[0]) {
#ifndef OLDVERSION
		/* adjust count for blank lines we stripped off */
		if (consec_newlines) {
			header.intnumlines -= consec_newlines;
			if (header.intnumlines < 0 )
				header.intnumlines = 0; /* paranoia */
			(void) sprintf(header.numlines, "%d", header.intnumlines);
		}
#endif /* !OLDVERSION */
		/*
		 * Check line count if there's already one attached to
	 .
	 .
	 .
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks