/dev/stdin
Tom Newcomb
newcomb at cory.Berkeley.EDU
Sun Jun 26 23:51:58 AEST 1988
After reading all the flap about /dev/stdin (and its omission from BSD UNIX), I
thought a while about the problem. First, is /dev/stdin supposed to be just a
link of sorts to one's TTY input? I can't think of anything else it should
reference, except perhaps fd0 in a shell script (and here, admittedly, my
case is worthless). If you want to do something like:
egrep 'Lo\! The Hounds of Hell eat Puppy Chow\!' `cat files /dev/stdin`'
then would not /dev/stdin be referring to TTY input? I should think that it
would always be used on command lines where stdin is not being redirected; I
don't know of too many programs that let you get away with something like this:
cat /dev/stdin < whangdoodle ; Send stdin and 'whangdoodle' to stdout
(Would /dev/stdin in this case be referring to 'whangdoodle', since it's now
standard input...?)
So, if all you want is the TTY input, why not use /dev/tty? It's worked
beautifully in all the cases I've tried. So, what am I missing? Can anybody
come up with a case where /dev/stdin would NOT be /dev/tty, besides shell
scripts? (I already know this won't work for scripts run from a shell whose
input has been redirected.) In a C program, also, you can just do an
fdopen(3) on descriptor 0 (and that ALWAYS works).
PLEASE send comments through E-MAIL!!!! I promise I'll summarize in a week or
so. Many thanks.
Tom Newcomb | WEST, v. West is what wabbits do when they
newcomb at cory.Berkeley.EDU | get tired of wunning awound.
More information about the Comp.unix.questions
mailing list