Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!wuarchive!udel!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul Falstad) Newsgroups: comp.lang.c Subject: Re: stdin and UNIX pipes Message-ID: <6452@idunno.Princeton.EDU> Date: 20 Feb 91 23:29:12 GMT References: <92993@unix.cis.pitt.edu> <1991Feb20.210406.21117@csrd.uiuc.edu> Sender: news@idunno.Princeton.EDU Distribution: na Organization: The Royal Society For Putting Things On Top Of Other Things Lines: 29 bliss@sp64.csrd.uiuc.edu (Brian Bliss) wrote: >saying > > fopen ("/dev/tty", "r"); > >always opens the screen for input, regardless of the state of stdin. >obvoulsy, somewhere (in libc.a?) there is code to check for the >string "/dev/tty", and open /dev/tty/tty?? instead of trying >to open the directory /dev/tty. Not quite. 1. it opens the _tty_ for input, _if_ your process has a controlling terminal. 2. there's no such directory /dev/tty. At least not on my system. It might have been a good idea, but a tad unportable since /dev/tty already exists. 3. the /dev/tty -> /dev/tty?? is done in the kernel by checking minor device numbers, not strings. It is not in libc; typing open("/dev/tty",2) opens a tty without touching any libraries (except for the actual trap code, of course). I'd redirect followups to a more appropriate group, like comp.unix.programmer, but I don't want them there either. :-) -- Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD I think there should be more race prejudice. LESS race prejudice. Princeton University apologizes for the content of this article.