exit(3C) DG/UX 4.30 exit(3C)
NAME
exit - Flush buffers and terminate the process normally.
SYNOPSIS
void exit();
int status;
exit(status);
where status is a return value.
DESCRIPTION
The exit function flushes the buffers associated with the
stdio(3s) functions and terminates the process normally.
The exit function also notifies the parent process if it is
executing a wait(2) function. The parent can use the low-
order eight status bits; the status value must be between 0
and 255.
RETURNS
If the function has a nonzero argument, it represents an
error code to be passed back to the parent process. If the
current process was invoked by a C program using one of the
exec functions, the return value is limited to 8 bits (0 -
255). A 0 value typically means no error occurred.
SEE ALSO
abort(3c), exec(2), wait(2), fork(2), vfork(2), wait3(2).
EXAMPLE
/* Program test for the exit() function */
#include <stdio.h>
int err, atoi(), exit();
main(argc, argv)
int argc;
char *argv[];
{
err = atoi(argv[1]);
exit(err);
}
If you call the program test with an argument of 256, you
receive the message
*WARNING*
Program 'exit'ed with a status of 0400
WARNING: FROM PROGRAM
Licensed material--property of copyright holder(s) Page 1