Why?? (prog question)
freebsd at edvax.de
Tue Mar 31 12:13:47 PDT 2009
On Tue, 31 Mar 2009 19:20:17 +0100, Bruce Cran <bruce at 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. :-)
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions