EOF problem under 4.3 and 2.10 BSD
Jack Nelson
jack at cadre.dsl.PITTSBURGH.EDU
Sun Jun 4 07:49:17 AEST 1989
I have encountered behavior in BSD 4.3 and 2.10 which differs from
sys V, rel 3.2 behavior, and seems to me to be a bug. If this program
is run, and a letter or a few are input, the behavior is as expected:
the line gets printed out. If one now hits ^D (EOF) at the prompt, the
last line (or else just the prompt if there was no input after the
last prompt) spews out repeatedly until interrupted with ^C.
Under sysV, a ^D just reechos the last line, which seems more
reasonable.
Any ideas? Any workarounds?
#include <stdio.h>
main()
{
char line[128];
for (;;) {
printf("> ");
gets(line);
printf("line is %s\n",line);
}
}
John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769 Dept. of Psychiatry, U. of Pittsburgh
UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt | psuvax1 | sun | sunrise | vax135 } ! cadre ! jack
ARPA: jack at cadre.dsl.pittsburgh.edu
--
John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769 Dept. of Psychiatry, U. of Pittsburgh
UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt | psuvax1 | sun | sunrise | vax135 } ! cadre ! jack
ARPA: jack at cadre.dsl.pittsburgh.edu
More information about the Comp.unix.wizards
mailing list