Re: [Integrit-users] exit status
Brought to you by:
ecashin
From: Ed L C. <ec...@te...> - 2001-10-26 20:20:06
|
"Gary E. Miller" <ge...@re...> writes: > Yo Ed! Yo! > On 26 Oct 2001, Ed L Cashin wrote: > > > Non-zero exit status is only for error conditions. Errors are > > problems that prevent the software in question from doing its job and > > that cannot be overcome by the software itself. > > Not true, This is NOT the UNIX way. I suggest you check out the > man pages for "diff", "cmp", etc... > > Diff: > An exit status of 0 means no differences were found, 1 > means some differences were found, and 2 means trouble. > > cmp: > The cmp utility exits with one of the following values: > > 0 The files are identical. > > 1 The files are different; this includes the case where one file is > identical to the first part of the other. In the latter case, if > the -s option has not been specified, cmp writes to standard output > that EOF was reached in the shorter file (before any differences > were found). > > >1 An error occurred. > > By analogy, integrit should return 0 on success, 1 on difference and 2 > on an error. From stdlib.h: /* We define these the same for all machines. Changes from this to the outside world should be done in `_exit'. */ #define EXIT_FAILURE 1 /* Failing exit status. */ #define EXIT_SUCCESS 0 /* Successful exit status. */ integrit was written in C after the ANSI standard came out. There are only two defined exit statuses for a C program: zero, EXIT_SUCCESS, and EXIT_FAILURE. The tools you refer to were developed before the ANSI standard. They are "grandfathered in". New programs, however, must respect the conventions of the world we live in now. Anyway, analogies like this are not helpful. gnapster always exits with 1 for no good reason. That doesn't mean integrit should. Standards conformance is a better guideline. -- --Ed Cashin PGP public key: ec...@te... http://www.terry.uga.edu/~ecashin/pgp/ |