4.2bsd eof flag in stdio

Jay Lepreau lepreau at utah-cs.UUCP
Sun Dec 2 15:54:57 AEST 1984


Jim at ISM780B states in two separate articles:
> show me the manual page for fread that says that 0 is returned upon EOF! 
> ...
> When discussing fine points of documentation, it is more accurate and less
> embarrassing to use your eyeballs, not your memory....
> you should not be so arrogant as to assume that you are not subject to
> such misconceptions without verifying it.
> ...
> NOWHERE DOES IT SAY THAT FREAD RETURNS ZERO UPON END-OF-FILE.

Taking Jim's own humble advice on the use of eyeballs and arrogance
I found in the v7 manual under fread(3):
	DIAGNOSTICS
		Fread and fwrite return 0 upon end of file or error.
And so does the 4.2 manual, which is derived from 32v which is derived
from v7.  Now, in Sys V (and Sys 3?), rather than change the code to
fix a bug they changed the documentation and removed that sentence.
Sun and UCB chose to fix the code.  Fine.  Arguments can be made both
ways.  (Of course I have strong opinions as to which is preferable.)

However, the so-called issue of whether or not ^D other than at the
beginning of a line should mean EOF is a straw man, and is not at issue
(or shouldn't be, anyway).  In any case it is orthogonal to the issue of
sticky-eof on ttys, and is just muddying the waters.  It's about as
germane and likely to change as adding ^^ or BCD to C.

Jay Lepreau



More information about the Comp.unix.wizards mailing list