Subject: Re: a few minor cleanups to src/share/misc/style
To: , <>
From: Chris G. Demetriou <>
List: tech-userlevel
Date: 03/21/2001 21:50:55 (Greg A. Woods) writes:
> Some failures aren't "random".

this is true.  there are some exit code interfaces interfaces that
rely on those.


> There are a few common classes of
> errors, common enough that there are even de facto standards for exit
> codes to represent them, the most common probably being usage errors
> (with a corresponding exit value of 2).

(1) "2 == usage error" is not in fact a well defined exit code value,
as far as I know; i've never seen a program invoking another try to
differentiate 'usage error' with "2", certainly...

(2) that disagrees with sysexits.h, and

(3) that disagrees with the one other (undocumented as far as I know,
though i'll admit that i've not looked hard) error code convention
i've seen, the one used by fsck.

> It would seem to me to be a very good thing to try and continue to
> "standardise" on using the manifests defined in <sysexits.h>.

Given that:

(1) approximately nothing does that now,

(2) except in special circumstances (where things do it now), there's
no great reason to because the only status cared about is

(3) C89 <stdlib.h> defines EXIT_SUCCESS & EXIT_FAILURE (and no other
exit code), and

(4) EXIT_SUCCESS and EXIT_FAILURE just happen to be symolic names for
the existing values already spec'd by KNF,

I'm inclined to recommend EXIT_SUCCESS and EXIT_FAILURE and only them
in src/share/misc/style.

BTW, i did a gre, and the only includes of sysexits.h in the NetBSD
source tree, excluding the stuff in the sendmail and postfix sources,

./libexec/rmail/rmail.c:#include <sysexits.h>
./sbin/mount_ntfs/mount_ntfs.c:#include <sysexits.h>
./usr.sbin/isdn/isdnd/rc_scan.l:#include <sysexits.h>
./usr.sbin/isdn/ispppcontrol/ispppcontrol.c:#include <sysexits.h>
./gnu/libexec/uucp/libunix/xqtsub.c:#include <sysexits.h>
./sys/dev/microcode/aic7xxx/aicasm.c:#include <sysexits.h>
./sys/dev/microcode/aic7xxx/aicasm_gram.y:#include <sysexits.h>
./sys/dev/microcode/aic7xxx/aicasm_scan.l:#include <sysexits.h>
./sys/dev/microcode/aic7xxx/aicasm_symbol.c:#include <sysexits.h>

that doesn't speak well for their practical utility, and I don't see
that we should go on a crusade to change that.