[NTG-context] feature request: texexec with exit code > 0

Tobias Burnus burnus at net-b.de
Tue Jun 20 11:51:50 CEST 2006


Hello,

Hans Hagen wrote:
> � wrote:
>   
>> Hello,
>>
>> could "texexec --nonstopmode file" please exit with exit code > 0, if there
>> is an error (such as undefined control sequence)?
>>     
> well, if you figure out the codes -)
> i always have problems with finding the right exit codes (not that consistent between script languages and os's) 
>   
Under Unix it is classically zero == no error, not zero == error. Which
non-zero number is returned is application dependent.

The POSIX standard 2001 (Single Unix Standard v3; (c) Open Group) writes
in its "Shell & Utilities section":

"The EXIT STATUS section describes the values the utility shall return
to the calling program, or shell, and the conditions that cause these
values to be returned. Usually, utilities return zero for successful
completion and values greater than zero for various error conditions. If
specific numeric values are listed in this section, the system shall use
those values for the errors described. In some cases, status values are
listed more loosely, such as >0. A strictly conforming application shall
not rely on any specific value in the range shown and shall be prepared
to receive any value in the range."


According to the ISO C99  standard, the default exit code is also 0:

"If the return type of the main function is a type compatible with int,
a return from the
initial call to the main function is equivalent to calling the exit
function with the value
returned by the main function as its argument;[...] reaching the } that
terminates the
main function returns a value of 0."

I do not know what DOS programs are doing, though.

Tobias



More information about the ntg-context mailing list