[nycbug-talk] FreeBSD Standard Exit Codes
Matthew Story
matthewstory at gmail.com
Mon Jul 9 14:51:53 EDT 2012
By way of .ike ... the following standard error codes have just been
brought to my attention ... pretty sweet
/* from head/includes/sysexits.h */
#define EX_USAGE 64 /* command line usage error */
#define EX_DATAERR 65 /* data format error */
#define EX_NOINPUT 66 /* cannot open input */
#define EX_NOUSER 67 /* addressee unknown */
#define EX_NOHOST 68 /* host name unknown */
#define EX_UNAVAILABLE 69 /* service unavailable */
#define EX_SOFTWARE 70 /* internal software error */
#define EX_OSERR 71 /* system error (e.g., can't fork) */
#define EX_OSFILE 72 /* critical OS file missing */
#define EX_CANTCREAT 73 /* can't create (user) output file */
#define EX_IOERR 74 /* input/output error */
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
#define EX_PROTOCOL 76 /* remote error in protocol */
#define EX_NOPERM 77 /* permission denied */
#define EX_CONFIG 78 /* configuration error */
Looks like bin/, usr.bin/ and usr.sbin/ executables all make use of these
exit codes correctly, wonder if anyone is doing anything with these, or
makes use of this standard in their programs. Only thing missing here is a
helper program for sh(1) to determine exit meaningfulness from exit code:
if causedexit $? USAGE DATAERR; then
# ...
elif causedexit $? NOUSER NOHOST; then
# ...
fi # etc ...
--
regards,
matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nycbug.org:8443/pipermail/talk/attachments/20120709/a45d2ff3/attachment.htm>
More information about the talk
mailing list