Chad R. Larson <[EMAIL PROTECTED]> wrote:
 > Why is there an overlap 
 > between the recommended codes in sysexits(3) and "/usr/include/errno.h"?

They serve different purposes, and are used for different
things, so there shouldn't be a conflict.

The errno values are used as return values from syscalls
and library functions.  They are _not_ used for program
exit codes.  Unfortunately, some programs print numerical
errno values because they're too stupid (or too lazy) to
use perror() or strerror() or some similar way to display
a readable error string.  Normally, the user should not
need to care about errno numbers at all.  They are for
programmers.

The sysexits(3) values were originally intended as a way
to communicate between programs:  When sendmail calls an
external program (e.g. mail_local or procmail), it checks
the exit code to find out if everything is alright, or if
a transient problem occured, or if something went out of
resources, or if a fatal error occured.  Depending on that,
sendmail deletes the mail, or spools it locally for another
delivery attempt at a later time, or bounces it back with
an appropriate error message.  Other, non mail-related
tools use sysexits(3) values, too, to further classify
the result beyond the traditional 0/ok and 1/failure, so
that scripts and other programs have a better chance to do
sensible things when something went wrong.  This is a good
thing, IMO.

Regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"All that we see or seem is just a dream within a dream" (E. A. Poe)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-stable" in the body of the message

Reply via email to