atexit(3C) atexit(3C)
NAME
atexit - add program termination routine
SYNOPSIS
#include <stdlib.h>
int atexit(void (*func)(void));
DESCRIPTION
atexit() adds the function func to a list of functions to be called
without arguments on normal termination of the program. A program is
terminated normally either by a call to exit() or by a return from
main. At most 32 functions may be registered by atexit(); the func-
tions will be called in the reverse order of their registration.
Any functions previously registered by atexit() are no longer
registered after a successful call to one of the exec functions.
atexit() returns 0 if the registration succeeds, non-zero if it fails.
APPLICATION USAGE
The functions registered by a call to atexit() must return to ensure
that all registered functions are called.
The application should call sysconf() to obtain the value of
ATEXITMAX, the number of functions that can be registered. There is
no way for an application to tell how many functions have already been
registered with atexit().
SEE ALSO
exit(2), sysconf(3C), stdlib(5).
Page 1 Reliant UNIX 5.44 Printed 11/98