Subject: Re: a few minor cleanups to src/share/misc/style
To: , <firstname.lastname@example.org>
From: Chris G. Demetriou <email@example.com>
Date: 03/21/2001 21:50:55
firstname.lastname@example.org (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>.
(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
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,
that doesn't speak well for their practical utility, and I don't see
that we should go on a crusade to change that.