Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!pt.cs.cmu.edu!cadre!jack From: jack@cadre.dsl.PITTSBURGH.EDU (Jack Nelson) Newsgroups: comp.unix.wizards Subject: EOF problem under 4.3 and 2.10 BSD Keywords: EOF stdio Message-ID: <2879@cadre.dsl.PITTSBURGH.EDU> Date: 3 Jun 89 21:49:17 GMT Organization: Decision Systems Lab., Univ. of Pittsburgh, PA. Lines: 30 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 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@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@cadre.dsl.pittsburgh.edu