Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Dec 2008 00:28:07 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        "Sean C. Farley" <scf@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org>
Subject:   Re: svn commit: r185362 - head/share/man/man9
Message-ID:  <20081203001117.P1758@besplex.bde.org>
In-Reply-To: <alpine.BSF.2.00.0811302005460.1578@baba.farley.org>
References:  <200811270842.mAR8gwi3080974@svn.freebsd.org> <alpine.BSF.2.00.0811302005460.1578@baba.farley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 Nov 2008, Sean C. Farley wrote:

> On Thu, 27 Nov 2008, Robert Watson wrote:
>
>> Log:
>>  Revert r184509: don't encourage the use of sysexits.h with err() and
>>  errx(),, as there seems to be a general preference against this
>>  practice.
>
> *snip*
>
>> 	if ((four = malloc(sizeof(struct foo))) == NULL)
>> -		err(EX_OSERR, NULL);
>> +		err(1, (char *)NULL);
>> 	if ((six = (int *)overflow()) == NULL)
>> -		errx(EX_DATAERR, "number overflowed");
>> +		errx(1, "number overflowed");
>
> Out of curiosity, why not EXIT_FAILURE instead of 1, at least in
> situations where including stdlib.h is allowed?  Is it because
> EXIT_FAILURE is only required to be non-zero and not necessarily 1?

It is because KNF doesn't use EXIT_FAILURE, and style(9) is primarily to
document what KNF does and not to change it.

Another bug in r184509 is that it didn't just encourage use of sysexits.h
but required it, by removing all examples of non-use of sysexits.h.
A non-example rule in style.9 still requires use of sysexits.h for all
nonzero exits, but is obviously wrong since it is inconsistent with the
2 examples shown in the above diff.

Bruce



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