How do I tell if STDIN is a PIPE?

der Mouse mouse at thunder.mcrcim.mcgill.edu
Sat Jun 8 00:54:14 AEST 1991


In article <23190 at shlump.lkg.dec.com>, lan_csse at netrix.nac.dec.com (CSSE LAN Test Account) writes:
> In article <653 at eskimo.celestial.com> nanook at eskimo.celestial.com (Robert Dinse) writes:
>> if(s.st_mode & S_IFIFO)
> On this machine (Ultrix 4.1) and on the next one over (Ultrix 3.1),
> this code says "Stdin is not a pipe.\n". On investigation, the status
> struct was *entirely* filled with null bytes.

mtXinu 4.3+NFS stat(2) manpage:

.SH BUGS
Applying
.I fstat
to a socket (and thus to a pipe)
returns a zero'd buffer,
except for the blocksize field,
and a unique device and inode number.

It seems other systems (like your Ultrices and probably vanilla 4.3) do
this as well.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.programmer mailing list