J^T: John Thywissen's personal pages

exit() status and main() return code

Per ANSI C and POSIX:

Value Symbol Description
0 EXIT_SUCCESS Program terminated successfully
1 EXIT_FAILURE Program terminated unsuccessfully
2 Usage (command line syntax) error
3 to 125 Other failure, implementation/program defined
126 Not executable
127 Command not found
128 to 255 Terminated by signal; Return code is signo+128

NOTE: Only 8 bits of the status value are used, even though the values are declared as int.