dmmartindale@watmath.UUCP (Dave Martindale) (12/03/84)
If a received article's Lines: header does not match the actual number of lines in the article body, inews logs an error saying "linecount expected 4 got 6". This can be rather confusing if the article in question has a header specifying 6 lines and the body really had 8 lines in it, including two trailing blank lines. What has happened is that the number of trailing blank lines have already been subtracted from both numbers before being compared and printed, making the source of "expected 4" rather obscure. It seems better to print out these two values without considering the effect of the trailing-line trimming, making the message more understandable: *** /tmp/inews.c Mon Dec 3 03:11:23 1984 --- inews.c Mon Dec 3 03:17:06 1984 *************** *** 775,788 xxit(1); } if (header.numlines[0]) { - /* adjust count for blank lines we stripped off */ - if (consec_newlines) { - header.intnumlines -= consec_newlines; - if (header.intnumlines < 0 ) - header.intnumlines = 0; /* paranoia */ - sprintf(header.numlines, "%d", header.intnumlines); - } - /* * Check line count if there's already one attached to * the article. Could make this a fatal error - --- 775,780 ----- xxit(1); } if (header.numlines[0]) { /* * Check line count if there's already one attached to * the article. Could make this a fatal error - *************** *** 792,798 */ if (linecount != header.intnumlines) { if (linecount) ! log("linecount expected %d, got %d", header.intnumlines, linecount); else xerror("%s rejected. linecount expected %d, got 0", header.ident, header.intnumlines); } --- 784,792 ----- */ if (linecount != header.intnumlines) { if (linecount) ! log("linecount expected %d, got %d", ! header.intnumlines, ! linecount+consec_newlines); else xerror("%s rejected. linecount expected %d, got 0", header.ident, header.intnumlines); } *************** *** 795,800 log("linecount expected %d, got %d", header.intnumlines, linecount); else xerror("%s rejected. linecount expected %d, got 0", header.ident, header.intnumlines); } } else { /* Attach a line count to the article. */ --- 789,802 ----- linecount+consec_newlines); else xerror("%s rejected. linecount expected %d, got 0", header.ident, header.intnumlines); + } + + /* adjust count for blank lines we stripped off */ + if (consec_newlines) { + header.intnumlines -= consec_newlines; + if (header.intnumlines < 0 ) + header.intnumlines = 0; /* paranoia */ + sprintf(header.numlines, "%d", header.intnumlines); } } else { /* Attach a line count to the article. */