casts to void

Peter da Silva peter at baylor.UUCP
Sun Aug 18 12:27:16 AEST 1985


> > OK. What should my whizzbang filter do when a write fails, other than
> > write an error message and quit?
> 
> The canonical UNIX tool should write a message such as "prog: write
> failed" to stderr (which may be writable even though stdout has a
> problem), restore terminal modes if necessary, remove temporary files,
> etc. then exit with a non-zero status code (so that the invoker of the
> program can detect the problem and take whatever strategic measures
> are needed).

Good, that's what I hoped you'ld say. Now if I have no temporary files
and don't change the terminal modes, that reduces to "perror(whatever);
exit();". Now if you could define a routine "ioerr(errno, fp)" that did
nothing in the standard stdio (except setting errno), then I could just
define "ioerr(errno, fp) { perror(filenameof(fp), errno); exit(errno); }
and l;eave all my printfs tidy. The implementation of "filenameof" is left
to the reader.
-- 
	Peter da Silva (the mad Australian werewolf)
		UUCP: ...!shell!neuro1!{hyd-ptd,baylor,datafac}!peter
		MCI: PDASILVA; CIS: 70216,1076



More information about the Comp.lang.c mailing list