Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!seismo!cmcl2!philabs!prls!pyramid!hplabs!sdcrdcf!burdvax!wpl From: wpl@burdvax.UUCP Newsgroups: net.sources.bugs Subject: Bug fix for vn Message-ID: <3086@burdvax.PRC.Unisys.COM> Date: Mon, 23-Mar-87 20:01:22 EST Article-I.D.: burdvax.3086 Posted: Mon Mar 23 20:01:22 1987 Date-Received: Fri, 27-Mar-87 05:51:44 EST Sender: news@burdvax.PRC.Unisys.COM Organization: Unisys/Paoli Research Center, Paoli, PA Lines: 47 Keywords: floating point exception I had a problem with vn. Once in a while, vn would crash with a floating point exception (divide by zero). I tracked to bug to the following lines of code in reader.c. /* for conditional is abnormal - expected exit is break */ for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count) { /* reset position and bail out at first non-header line */ if (index(buf,':') == NULL) { pos = ftell(Fpread); pos -= strlen(buf); fseek (Fpread,pos,0); break; } Vn had thought the header ended when there was a line with no ':'. This is a false assumption (I think), a header ends when there is a line that doesn't begin with ' ' or '\t' and has no embedded ':'. Below is the fix to the above code. /* for conditional is abnormal - expected exit is break */ for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count) { /* reset position and bail out at first non-header line */ if (index(buf,':') == NULL) { if ((buf[0] != '\t') && (buf[0] != ' ')) { pos = ftell(Fpread); pos -= strlen(buf); fseek (Fpread,pos,0); break; } } Bill Loftus -- William P Loftus UUCP: wpl@burdvax, sword@excalibur Unisys/Paoli Research Center ARPA: wpl@burdvax.prc.unisys.com PO Box 517 BITNET: SWORD@VUVAXCOM Paoli, PA 19301 215-648-7222 (work) 215-649-0633 (home)