How do I tell if STDIN is a PIPE?
Dave Eisen
dkeisen at leland.Stanford.EDU
Tue Jun 4 03:51:17 AEST 1991
In article <1991Jun3.150851.21915 at prl.dec.com> boyd at prl.dec.com (Boyd Roberts) writes:
>You don't test for anything that way. This:
>
> if ((sb.st_mode & S_IFMT) == S_IFIFO)
>
>is the way it's done (unless you have those gory POSIX macros). But,
Of course, it is (my brain slipped when I was typing and I wrote S_IFREG in
place of S_IFMT). That still doesn't change the point of my posting ---
on this machine (running ULTRIX 4.1), sb.stmode & S_IFMT is 0 for a pipe.
--
Dave Eisen dkeisen at leland.Stanford.EDU
1101 San Antonio Road, Suite 102
Mountain View, CA 94043
(415) 967-5644
More information about the Comp.unix.programmer
mailing list