getchar() question in 4.2
Larry Philps
larry at uthub.UUCP
Thu May 3 05:14:09 AEST 1984
[]
I have also been bothered by the change in the stdio "get"
interface. In particular the code that was changed is
in filbuf.c where |_IOEOF was added to the if condition.
if (iop->_flag&(_IOSTRG|_IOEOF))
return(EOF);
This is a reasonable thing to do when reading from a real
file, but when the reads are from a tty, it is quite possible
to have multiple EOF's on the same stream (ex. learn, addbib, ...).
Can anyone think of any problems that would result from changing
the above to:
if (iop->_flag&_IOSTRG)
return(EOF);
if ((iop->_flag&_IOEOF) && !isatty(fileno(iop)))
return(EOF);
This would force the 4.1BSD protocol when reading from tty's
and the 4.2BSD protocol at all other times. I have not tried
this myself, but think it should work without mucking up anything else.
--
UUCP: { allegra cornell decvax decwrl floyd ihnp4 linus
sask ubc-vision utzoo uw-beaver watmath } !utcsrgv!uthub!larry
More information about the Comp.unix.wizards
mailing list