Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site baylor.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!ut-ngp!shell!neuro1!baylor!peter
From: peter@baylor.UUCP (Peter da Silva)
Newsgroups: net.lang.c
Subject: Re: Re: Re:  casts to void
Message-ID: <447@baylor.UUCP>
Date: Sat, 17-Aug-85 22:27:16 EDT
Article-I.D.: baylor.447
Posted: Sat Aug 17 22:27:16 1985
Date-Received: Sat, 24-Aug-85 02:24:03 EDT
References: <485@brl-tgr.ARPA> <361@baylor.UUCP> <701@brl-tgr.ARPA>
Organization: The Power Elite, Houston, TX
Lines: 21

> > 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