Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2009 19:20:17 +0100
From:      Bruce Cran <bruce@cran.org.uk>
To:        Polytropon <freebsd@edvax.de>
Cc:        Gary Kline <kline@thought.org>, FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Why??  (prog question)
Message-ID:  <20090331192017.61958b53@gluon.draftnet>
In-Reply-To: <20090331112122.ae329221.freebsd@edvax.de>
References:  <20090331025726.GA10888@thought.org> <20090331112122.ae329221.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 31 Mar 2009 11:21:22 +0200
Polytropon <freebsd@edvax.de> wrote:

> 4. Use the predefined return codes, don't hardcode them.
>    FreeBSD has EXiT_SUCCESS and EXIT_FAILURE, they're for
>    maximum compatibility (such as with Linux). There are
>    more exit codes for differentiation, but they're specific
>    to FreeBSD, as far as I know.

Linux seems to have adopted sysexits.h too, which provides error codes
such as EX_USAGE and EX_CANTCREAT. However, in FreeBSD at least the most
common programming style is to use 1 for error and 0 for success - e.g.
from style(9):

errx(1, "number overflowed");

-- 
Bruce Cran



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090331192017.61958b53>