Steven M. Schweda wrote:

> Having the exit codes defined in a central location would make it easy
> to adapt them as needed.  Having to search the code for every instance
> of "return 1" or "exit(2)" would make it too complicated.

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);

This function should be called any time there is an event that might
influence the exit code and the function can then decide what exit code
should be used based on all calls made prior to the end of program
execution. Not only will such an approach restrict the logic for setting the
error code to one place in the code, it will make OS-specific versions of
the error code (such as what Steven desires for VMS) much easier to
implement.

The biggest challenge will be determining the list of WGET_EXIT_* constants
and the interactions between them that influence the final value of the exit
code.

(Was that worth two cents?)

Tony


Reply via email to