roland@moncskermit.UUCP (01/28/87)
There is a bug? in vn which will lead to a floating point exception,
divide by 0. This occurs when reading an article where headers before
the "Lines:" extend over 1 line causing artlin to be 0.
The patch below will fix vn in this case to arbitrarily display 100%
in the reader if artlin == 0.
Roland Yap ACSNET,CSNET:roland@moncskermit.oz
Dept. of Computer Science ARPA:roland%moncskermit.oz@seismo.arpa
Monash University UUCP: ..!seismo!munnari!moncskermit.oz!roland
Clayton ...!{decvax,pesnta,vax135}!mulga!moncskermit.oz!roland
Australia 3168
moncsbruce can also be substituted for moncskermit
-----------------< cut here and submit to patch >------------------------
*** oldreader.c Wed Jan 28 14:11:59 1987
--- reader.c Wed Jan 28 14:09:21 1987
***************
*** 201,207
*/
if (Headflag)
percent = ((Rlines-2)*100)/(artlin+Hlines);
! else
percent = ((Rlines-Hlines-2)*100)/artlin;
sprintf (pstr,PAGE_MID,percent);
}
--- 201,208 -----
*/
if (Headflag)
percent = ((Rlines-2)*100)/(artlin+Hlines);
! /* Problem here in that gethead can return artlin=0 */
! else if (artlin > 0.0)
percent = ((Rlines-Hlines-2)*100)/artlin;
/* fudge with arbitrary number */
else percent = 100;
***************
*** 203,208
percent = ((Rlines-2)*100)/(artlin+Hlines);
else
percent = ((Rlines-Hlines-2)*100)/artlin;
sprintf (pstr,PAGE_MID,percent);
}
else
--- 204,211 -----
/* Problem here in that gethead can return artlin=0 */
else if (artlin > 0.0)
percent = ((Rlines-Hlines-2)*100)/artlin;
+ /* fudge with arbitrary number */
+ else percent = 100;
sprintf (pstr,PAGE_MID,percent);
}
elsebobm@rtech.UUCP (02/04/87)
OK, we had a discussion on this one a few weeks back. Preventative medicine
like this is a good idea, but you should also go into the gethead() routine
in that same source and replace
if (index(buf,':') == NULL)
with
if (buf[0] == '\n')
To be more correct, you should incorporate a special fgets that folds the
continued header lines, such as someone posted, but given the use being
made of the header lines in this context, it probably won't matter - the
examples I've seen don't fold any relevent lines, and the Subject will
be truncated anyway.
I'm curious about something - vn has been happily running with the original
logic from the first issue of the program, and in my private copies for the
last 3 years. Somebody has just recently started sending out the continued
lines - seemingly all articles from BITNET. I admit that they're allowed
to do so, and that looking for the colon is a bug, but I'd still like to
know what issue of what posting software is generating the folded lines now.
Only from BITNET? Only at 2.11 sites? We're running 2.10.3, and I can't
say that I've ever seen such an article here.
--
Bob McQueer
{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm