stdio/sh behaviour guaranteed?
Jan Grant
jan.grant at bristol.ac.uk
Fri Jul 7 19:24:02 UTC 2006
Consider the following snippet.
[[[
#!/bin/sh
echo one > t
while read line
do
echo $line
case $line in
one) echo two >> t
;;
two) echo three >> t
;;
esac
done <t
]]]
This produces three lines of output on FreeBSD: which is what I'd
intuitively expect and it's certainly useful behaviour.
I'm just trying to determine if that behaviour is one that I can rely on
- in other words, I guess, if stdio performs a "short read" that fails
to fill a buffer, and the underlying file is then extended outside the
process, will another attempt to read from the FILE* (or a test of feof,
say) honour the new, longer file contents? And in particular, is the
idiom above blessed by appropriate posix standards?
I'm having a hard time pinning down any appropriate standards that deal
with this.
Cheers,
jan
PS. Would appreciate a CC: on any responses.
--
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
Not as randy or clumsom as a blaster.
More information about the freebsd-standards
mailing list