Unix deficiencies/problems
Mike Spitzer
mjs at mentor.cc.purdue.edu
Mon May 8 01:37:28 AEST 1989
In article <424 at algor2.UUCP> jeffrey at algor2.UUCP (Jeffrey Kegler) writes:
>I miss very little from the IBM world, but the availability of formal file
>names is one of them. Once UNIX starts getting into commercial
>environments they will become more useful. Briefly, a formal file name is
>a name by which the program interfaces with a JCL (or shell) language and
>which can be redefined. UNIX has 3 usable ones, stdin, stdout and stderr,
>and that covers a remarkable variety of situations. But an application
>might well want one or two databases, an transaction input file, an error
>output, a logging file and 2 or 3 reports. It would be nice if each of
>these could be redirected as easily as stdin, stdout and stderr.
The Bourne shell and other reasonably sh-compatatible shells (like
ksh) allow the redirection of any file descriptor, not just stdin,
stdout, and stderr. You can have the shell open these file
descriptors for your program and have "formal files" as you describe
above. To use your example, you could:
application <input >logfile 2>errs 3<db1 4<db2 5>rep1 6>rep2
Of course, "application" would have to know which file descriptors to
use for which purpose. Also, the first thing that it should do is
verify that all of the proper file descriptors are open (fstat(2)
would work).
There is a limitation, though. In this case you might want to have
db1 and db2 open for both reading and writing, but there is no way to
make the shell do that do you. You could always have one file
descriptor for reading and one for writing on the same file, but that
isn't always what you really want to do....
--
Michael J. Spitzer Purdue University Computing Center
mjs at mentor.cc.purdue.edu pur-ee!mentor.cc.purdue.edu!mjs
More information about the Comp.unix.questions
mailing list