[comp.windows.misc] comamnds into pipes

mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) (08/06/87)

[Cross-posted to comp.misc, where it belongs, and followups pointer
that way.]

In article <555@its63b.ed.ac.uk> xsimon@its63b.ed.ac.uk (Simon Brown) writes:
<You can also implement this on a system that has FIFO special files. This
<has the advantage that the filenames that are passwd to the program are
<not forced to be of that special form /dev/fd/[number] - anything will do,
<so long as you can mknod a fifo with that name!

You can do that with the /dev/fd driver, under the exact same
constraints. All you need is the ability to get a file name that
references the correct major/minor device number. The only advantage I
see for fifos is that non-root users may be able to mknod them,
whereas they can't mknod a device.

But in practice (on BSD, anyway) that's not much of a problem. All you
need to do is create a symlink to the appropriate /dev/fd file. For
example, a couple of times I've wanted to compile stuff coming out of
a pipe. The sequence is like so:

ln -s /dev/stdin pipeout.c
<pipe of stuff> | cc pipeout.c
<repeat above until happy>
rm pipeout.c

Works like a charm.

On the other hand, the /dev/fd driver gives you /dev/stdin and
friends. These are worth having all by their lonesome, and I don't
think they can be duplicated by fifos.

	<mike
--
It's been a hard day's night,				Mike Meyer
And I been working like a dog.				mwm@berkeley.edu
It's been a hard day's night,				ucbvax!mwm
I should be sleeping like a log.			mwm@ucbjade.BITNET