standardized error messages

John Quarterman jsq at ut-sally.UUCP
Mon Jul 22 04:04:51 AEST 1985


se enough to keep in the same discussion.

----------------------------------------------------------------------

Date: Sat, 20 Jul 85 16:52:04 PDT
From: seismo!sun!guy (Guy Harris)
To: ut-sally!std-unix
Subject: Standardizing exit codes

There is currently no universal standard for the meaning of exit codes,
except that 0 means "true" or "success" and non-zero means "false" or
"failure".  Some System V programs use 2 for syntax errors, failure to open
files, and the like, and 1 for "the command was run properly but gives a
result of 'false'".  "delivermail" and "sendmail" expect programs they run
to exit with an error code from the include file <sysexits.h> which has a
number of exit codes which further break down "failure to execute properly"
(like exit code 2 in those System V commands) into "incorrect usage", "input
data incorrect", "input file could not be opened", etc..

It might be useful to adopt some convention like that of <sysexits.h>.  Exit
code 0 would mean "the command executed without problems and returns a
'true' result; exit codes from 1 to some number N1 - 1 would mean "the
command executed without problems and returns a 'false' result" - the exit
code could be used to further specify the type of "false" result, if
desired; exit codes from N1 to 254 could mean "the command did not execute
successfully" and the exit codes from <sysexits.h> could break this down
further; and exit code 255 would be reserved for forked-off child processes
which were supposed to "exec" something but the "exec" failed.  (In
<sysexits.h>, N1 has the value 64.)

	Guy Harris

------------------------------



More information about the Mod.std.unix mailing list