/dev/stdin

William C. DenBesten denbeste at bgsuvax.UUCP
Tue Jun 28 00:59:47 AEST 1988


>From article <4096 at pasteur.Berkeley.Edu>, by newcomb at cory.Berkeley.EDU (Tom Newcomb):

> 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?

sure.

      ls -1 | sort -r -

The dash at the end indicates to sort that it should do a fdopen(0).
The problem is that this causes ugly special case code within sort.  If I
instead said:

       ls -1 | sort -r /dev/stdin

the OS would deal with the fact that I want stdin.  This would clean
up code, since the file opening code can be located in just one place.
In addition, you could then pipe input into programs that were not
designed to use standard input.

-- 
 William C. DenBesten
 denbeste at bgsu.edu



More information about the Comp.unix.wizards mailing list