svn commit: r185362 - head/share/man/man9

Bruce Evans brde at optusnet.com.au
Tue Dec 2 05:28:11 PST 2008


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


More information about the svn-src-head mailing list