4.2bsd eof flag in stdio

Geoff Kuenning geoff at desint.UUCP
Mon Dec 3 07:12:14 AEST 1984


In article <528 at cbosgd.UUCP> ka at cbosgd.UUCP (Kenneth Almquist) writes:

>If we may believe Bill Shannon, the whole issue arose because nobody
>could figure out how to make a straightforward change to fread.

Bill said quite explicitly that the change arose because they wanted to make
the behavior of fread consistent.  I am sure that Bill is capable of coming
up with the push_back_eof algorithm all by his little old self -- if, after
considering the design aspects of the situation, he decides that is the
behavior he wants.

If you intend to write portable software, don't assume you can continue
reading from a terminal after EOF.  For my money, I would much rather pay
a small backwards-compatibility price to achieve a stdio implementation that
was truly portable.

In any case, most programs that expect to get more than one EOF from a
terminal are broken, because you will get different results if you redirect
from a file.  Sure, there are special exceptions like slowread (aka tail -f
aka tra), but let's be honest, folks -- of all the files you access in a
day, how many do you access while they are growing?  Normally, you make use
of existing, non-growing files, and a program expecting two EOF's from a
terminal will always get a null second file if it is redirected.
-- 

	Geoff Kuenning
	...!ihnp4!trwrb!desint!geoff



More information about the Comp.unix.wizards mailing list