HP C/iX Library Reference Manual (30026-90004)

138 Chapter5
HP C/iX Library Function Descriptions
exit
exit
Terminates the calling process normally.
Syntax
#include <stdlib.h>
void exit (int
status
);
Parameters
status
A value passed to the environment upon program termination.
Return Values
None.
Description
The exit function terminates the calling process. The parameter
status
is returned to the
MPE/iX command interpreter using the CJCW job control word. By convention, a
status
value of zero (0) indicates EXIT_SUCCESS, and a value of one (1) indicates EXIT_FAILURE.
You may establish additional return values as required.
Using the return
expression
statement from main() in a C program has the same effect
as using exit(), where
status
is equivalent to
expression
. This value returned using
CJCW is undefined if main() does not return a value or explicitly call exit().
The exit function causes all functions registered by the atexit function to be called in the
reverse order of their registration. The exit function then triggers the system-level
clean-up procedures. All output streams are flushed. All stream are closed. All files created
by the tmpfile function are deleted.
See Also
abort(), atexit(), ANSI C 4.10.4.3, POSIX.1 8.1