Date: Fri, 7 Jul 2006 20:23:50 +0100 (BST) From: Jan Grant <jan.grant@bristol.ac.uk> To: freebsd-standards@freebsd.org Subject: stdio/sh behaviour guaranteed? Message-ID: <20060707201402.T14116@tribble.ilrt.bris.ac.uk>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060707201402.T14116>