'exit(1);' considered useless (sligh - (nf)

jab at uokvax.UUCP jab at uokvax.UUCP
Wed Feb 8 14:48:15 AEST 1984


#R:proper:-95700:uokvax:6100019:000:1154
uokvax!jab    Feb  5 21:26:00 1984

/***** uokvax:net.unix / proper!gam /  6:58 pm  Feb  2, 1984 */
As a maintainer and supporter of existing software, I am getting
tired of programs whose terminating action is:

	exit(1);
/* ------------- */

This person has a point, and there's a response saying "well, use 'perror'".
However, the "exit code" is something that classically was taken as a boolean,
meaning "yes, it worked" or "no, it didn't work". I won't defend that, but
let me remind you that in certain parts of the software world, those exit
codes are all important. Imagine the following exit status:

	#define	DIEDHORRIBLY	03231

where if the program exists with "DIEDHORRIBLY", something terrible has 
happened and the shell should log the user out. VAX/VMS has such a status,
and in fact, the command interpreter is responsible for telling you what
went wrong (it gets its information from, you guessed it, the exit status.)

No matter how bad it seems, there's always something worse. Probably the
most handy set of exit codes are of the form where one status means "what you
requested was stupid" and another means "well, I did what you told me and
got nothing".

	Jeff Bowles



More information about the Comp.unix mailing list