Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!sri-unix!dbj@rice From: dbj%rice@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: Re: 4.2BSD _filbuf() question Message-ID: <15779@sri-arpa.UUCP> Date: Fri, 20-Jan-84 20:48:30 EST Article-I.D.: sri-arpa.15779 Posted: Fri Jan 20 20:48:30 1984 Date-Received: Sat, 21-Jan-84 23:02:36 EST Lines: 21 From: Dave Johnson "i'd say it's cat's fault for treating `-' as a special case rather than opening and closing the tty like it would any other file." Reading standard input each time for the "-" does NOT mean "opening and closing the tty"! Standard input is whatever is on file descriptor 0 when the program starts up; it is not always the terminal. Also, if you have done an "su" to some other user (other than root) after logging on, "cat" will usually be unable to open the terminal since usually only the person who actually logged on to the terminal can read from it (although it could get at the terminal with "/dev/tty" rather than the specific terminal). "Cat" should simply do a clearerr() on stdin after reaching the end of file each time, so that when it needs to read stdin again for the next "-", it won't think that it's already at end of file. Dave Johnson Dept. of Math Science Rice University dbj@rice