csh reading from stdin
Maarten Litmaath
maart at cs.vu.nl
Fri Aug 24 01:24:25 AEST 1990
In article <glenn.651406891 at bilby>,
glenn at wacsvax.uwa.oz (Glenn Huxtable) writes:
)...
)[SunOS 4.0.3]
)
) set line=$<
) # decide which filter
) (echo $line ; cat) | $FILTER
)
)this resulted in two copies of the first line.
1) The bug is in `cat': it reads the file using mmap(2), blindly assuming
you want to start reading at byte offset 0. :-(
Probably fixed in SunOS 4.1.
You can't mmap() a pipe, so things work correctly if stdin is a pipe,
as cat must use read(2) in that case.
2) Your scheme depends on csh reading the line 1 byte at a time (normally
file IO is _block-buffered_); though your implicit assumption appears
to be correct indeed, the manual doesn't guarantee it. :-(
--
"[Your C code] seems about as portable as the Rock of Gibraltar."
(Wayne Throop)
More information about the Comp.unix.questions
mailing list