stdio buffering considered harmful

Dave Lukes pdl at root44.UUCP
Tue Aug 2 00:49:25 AEST 1983


Agreed: stdio's buffering is painful (BTW: to all of you out there in the
dark ages: SIII and upwards ALSO have an m4 flag to do line buffering (yuk)).

The problem with the environment hack is that it doesn't really offer fine
enough control, (you probably don't want any temp. files etc. being line
buffered just because the standard output is a pipe).
I suppose it could be extended to allow you to say `gimme block buffering
on files, single character buffering on terminals and line buffering on pipes',
but the syntax would no doubt be so horrendous that no-one would use it.

(BTBTW: you can GUESS if it's a pipe by doing a seek on it and seeing if
you get errno == ESPIPE, or, with SIII (rah, rah), you can see if 
((statbuf.st_mode&S_IFMT) == S_IFIFO)).

			'Nuff said (he he)
				Dave Lukes (...!vax135!ukc!root44!pdl).



More information about the Comp.unix.wizards mailing list