stdout (was What "isatty"?)
Brandon S. Allbery
allbery at ncoast.ORG
Sun Jun 4 04:12:01 AEST 1989
As quoted from <7509 at bsu-cs.bsu.edu> by dhesi at bsu-cs.bsu.edu (Rahul Dhesi):
+---------------
| In article <17796 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
| >As you can see by the `:-)' sign, Jimmy C. is kidding. But there is
| >much truth in this. The C compiler should write to stdout, unless
| >there is some overriding reason that it cannot...
|
| I can think of a moderately overriding reason that it should not.
| Generalizing:
|
| Programs should write to stdout when their output would make sense
| on a computer terminal, or when their output is likely to be
| redirected elsewhere and used properly. Programs that seek are an
| exception.
|
| Unfortunately, cc's output will put most terminals in a funny state,
| and cc is often invoked interactively.
+---------------
By that argument, "cat /bin/sh > /dev/tty" should refuse to work because
it's writing a binary file to the terminal. Foo.
"...likely to be redirected elsewhere": if cc had been written correctly,
people using it would know that it outputs a binary file and would therefore
be "likely to be redirected elsewhere." (Actually, if "cc" had been written
correctly, it would output assembly language, which is ASCII, so the point
is moot.)
++Brandon
--
Brandon S. Allbery, moderator of comp.sources.misc allbery at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu
Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser
More information about the Comp.unix.wizards
mailing list