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

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 31 Mar 2009 19:20:17 +0100, Bruce Cran <bruce@cran.org.uk> wrote:
> Linux seems to have adopted sysexits.h too, which provides error codes
> such as EX_USAGE and EX_CANTCREAT.

Good to know this, thanks. I'm not a big Linux user and a much
smaller Linux programmer (read: I don't program for Linux), so
I wasn't aware that they use it, too.



> 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");

This matches the definition of the two EXIT_* variables in
the standard library header file:

	% grep EXIT /usr/include/stdlib.h 
	#define EXIT_FAILURE    1
	#define EXIT_SUCCESS    0

It's no problem to use 0 and 1, but personally, I think the
"verbose reason" is better to read. :-)



And thanks for the pointer to "man 9 style", I see that I've
practiced a quite good style over the years without even
knowing it. :-)

-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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