Xref: utzoo comp.unix.questions:7781 comp.unix.wizards:9600
Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!cory.Berkeley.EDU!newcomb
From: newcomb@cory.Berkeley.EDU (Tom Newcomb)
Newsgroups: comp.unix.questions,comp.unix.wizards
Subject: /dev/stdin
Message-ID: <4096@pasteur.Berkeley.Edu>
Date: 26 Jun 88 13:51:58 GMT
Sender: news@pasteur.Berkeley.Edu
Reply-To: newcomb@cory.Berkeley.EDU (Tom Newcomb)
Distribution: na
Organization: University of California, Berkeley
Lines: 30

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@cory.Berkeley.EDU	| 	get tired of wunning awound.