MAN pages say you can't (?) FCLOSE any input files.

idallen at watmath.UUCP idallen at watmath.UUCP
Thu Jan 9 08:23:27 AEST 1986


Our 4.1/4.2bsd and Ultrix documentation says that FCLOSE or FFLUSH on a
non-output file must return EOF.  Now, it doesn't say that an EOF
indicates an error, but I assume that is what is meant.  In reality
(4.1/4.2/Ultrix), FCLOSE on an input file returns zero because FFLUSH
of an input file returns zero and that is the value FCLOSE returns.

We've modified FFLUSH to return EOF (indicating an error) when applied to
a non-output file, but that means FCLOSE is also returning that EOF
when applied to an input file, which we find hard to stomach.

We want to amend the documentation to state that FCLOSE may be applied
to an open input file, and it will return zero in this case.
Any reason not to do this?

Simple votes or comments not of world-wide interest should be mailed to me,
not posted to the whole net, please.

Note: For those who, like I, thought FFLUSH should be applicable to a
buffered input stream, consider the portability problems associated
with making sure that not only have you flushed all the input buffered
in your library, but also the input held by the operating system.
In reality, 4.2bsd FFLUSH does absolutely nothing when passed an input
file descriptor, and it returns zero.  Ours now returns EOF.
-- 
        -IAN!  (Ian! D. Allen)      University of Waterloo



More information about the Comp.unix.wizards mailing list