Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site whuxle.UUCP Path: utzoo!watmath!clyde!floyd!whuxle!mp From: mp@whuxle.UUCP (Mark Plotnick) Newsgroups: net.bugs.4bsd Subject: addbib vs. EOF Message-ID: <289@whuxle.UUCP> Date: Wed, 28-Mar-84 09:37:29 EST Article-I.D.: whuxle.289 Posted: Wed Mar 28 09:37:29 1984 Date-Received: Thu, 29-Mar-84 05:35:04 EST Organization: Bell Labs, Whippany Lines: 46 addbib (part of refer) has the old 4.2bsd sticky-EOF misfeature, and will go into an infinite loop after you enter an abstract. The following fix (1) adds a clearerr() after the read-in-the-abstract loop and (2) returns if the user hits EOF again. *** addbib.c.bsd Sun May 8 17:34:26 1983 --- addbib.c Tue Mar 27 14:53:16 1984 *************** *** 158,163 } fputs(line, fp); } } fflush(fp); /* write to file at end of each cycle */ if (ferror(fp)) --- 158,164 ----- } fputs(line, fp); } + clearerr(stdin); } fflush(fp); /* write to file at end of each cycle */ if (ferror(fp)) *************** *** 167,173 } editloop: printf("\nContinue? "); ! fgets(line, BUFSIZ, stdin); if (line[0] == 'e' || line[0] == 'v') { bibedit(fp, line, argv); --- 168,175 ----- } editloop: printf("\nContinue? "); ! if(fgets(line, BUFSIZ, stdin) == NULL) ! return; if (line[0] == 'e' || line[0] == 'v') { bibedit(fp, line, argv); Mark Plotnick Home of the UNIX Molecule