stdin and UNIX pipes
Paul Falstad
pfalstad at phoenix.Princeton.EDU
Thu Feb 21 10:29:12 AEST 1991
bliss at 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 at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
I think there should be more race prejudice. <slap> LESS race prejudice.
Princeton University apologizes for the content of this article.
More information about the Comp.lang.c
mailing list