addbib vs. EOF
Mark Plotnick
mp at whuxle.UUCP
Thu Mar 29 00:37:29 AEST 1984
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
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list