From: Hrvoje Niksic <[EMAIL PROTECTED]>

> "Tony Lewis" <[EMAIL PROTECTED]> writes:

> > It seems to me that the easiest way to deal with exit codes is to have a
> > single function to set the exit code. For example:
> >
> >   setexitcode(WGET_EXIT_SUCCESS);
> > or
> >   setexitcode(WGET_EXIT_QUOTA_EXCEEDED);
> > [...]

> What Wget could do is:
> 
> * If no errors have been set, return 0.
> [...]

   I don't want to seem like a chronic complainer (although that might
be an accurate description), but "return 0" is exactly the wrong thing
to do.  Better would be "return WGET_EXIT_SUCCESS" (or something
similar).

   For example, in the (highly portable) Info-ZIP Zip program, ziperr.h
includes macros like these:

#define ZE_MISS         -1      /* used by procname(), zipbare() */
#define ZE_OK           0       /* success */
#define ZE_EOF          2       /* unexpected end of zip file */
#define ZE_FORM         3       /* zip file structure error */
#define ZE_MEM          4       /* out of memory */
[...]

   Please note that "ZE_OK" exists, and it's used instead of a
hard-coded zero.

   Even better, Zip has a macro, EXIT (frequently defined as "exit"),
which is used in all places where an exit status is returned to the OS. 
(On VMS, it's defined as "vms_exit", a VMS-specific function in which
special VMS stuff is done, like combining the raw status value with a
severity code and a facility code, before calling the normal exit()
function.)

   That's just good engineering, not over-engineering.

------------------------------------------------------------------------

   Steven M. Schweda               (+1) 651-699-9818
   382 South Warwick Street        [EMAIL PROTECTED]
   Saint Paul  MN  55105-2547

Reply via email to