home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.misc:3907 comp.unix.programmer:4440
- Newsgroups: comp.sys.sun.misc,comp.unix.programmer
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
- From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
- Subject: Re: Yet another /dev/fd driver implementation
- Message-ID: <mcook.714759974@fendahl.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fendahl.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <1992Aug23.171952.11050@colorado.edu> <NICKEL.92Aug24174931@desaster.cs.tu-berlin.de> <QUANSTRO.92Aug24140601@lars.StOlaf.edu>
- Date: Tue, 25 Aug 1992 16:26:14 GMT
- Lines: 34
-
- quanstro@lars.StOlaf.edu (goon) writes:
-
- >In article <NICKEL.92Aug24174931@desaster.cs.tu-berlin.de> nickel@cs.tu-berlin.de (Juergen Nickelsen) writes:
- > > This is an implementation of the /dev/fd driver. This driver provides
- > > access to a process's file descriptors via the file system name space.
- > > For example, when a process opens /dev/fd/9 the operation performed is
- > > the equivalent of dup(9).
- > > Standard input/output/error (i.e. descriptors 0,1,2) are also visible
- > > as /dev/{stdin,stdout,stderr}.
-
- > A similar driver has been posted some time ago. Well, it really
- > *looks* interesting, but what is the advantage for the programmer (or
- > for someone else) to have the file descriptors as files?
-
- >Just a few examples:
- >o Consider your standard brain-dead program fu that will only read from
- > files. With /dev/fd one can hallucinate fu into thinking that it is
- > reading a file when you are feading it stdin.
- > bar | fu /dev/fd/0
- >o Suppose that you want to force a program to read from wierd file
- > descriptors without hard-wiring the program.
- > make | groak_cryptic_errors_and_tell_emacs /dev/fd/2
- >o Suppose that you want a program to read directly from the output of
- > several programs at once (i.e. non-linear pipes). It can read from
- > /dev/fd/? on any { ? | ? is a valid (open for reading) file descriptor}.
-
- The times I've wished I had /dev/stderr were when I was trying to get my AWK
- scripts to send their error messages to stderr.
-
- print "you goofed" > "/dev/stderr"
-
- (BTW, GAWK'll simulate the /dev/std* and /dev/fd/* mechanisms for you.)
-
- Michael.
-