5 |
* %sccs.include.redist.c% |
* %sccs.include.redist.c% |
6 |
*/ |
*/ |
7 |
|
|
8 |
|
|
9 |
|
/* |
10 |
|
|
11 |
|
@deftypefun int xatexit (void (*@var{fn}) (void)) |
12 |
|
|
13 |
|
Behaves as the standard @code{atexit} function, but with no limit on |
14 |
|
the number of registered functions. Returns 0 on success, or @minus{}1 on |
15 |
|
failure. If you use @code{xatexit} to register functions, you must use |
16 |
|
@code{xexit} to terminate your program. |
17 |
|
|
18 |
|
@end deftypefun |
19 |
|
|
20 |
|
*/ |
21 |
|
|
22 |
/* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. |
/* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. |
23 |
If you use xatexit, you must call xexit instead of exit. */ |
If you use xatexit, you must call xexit instead of exit. */ |
24 |
|
|
27 |
|
|
28 |
#include <stdio.h> |
#include <stdio.h> |
29 |
|
|
30 |
#ifdef __STDC__ |
#ifdef ANSI_PROTOTYPES |
31 |
#include <stddef.h> |
#include <stddef.h> |
32 |
#else |
#else |
33 |
#define size_t unsigned long |
#define size_t unsigned long |
34 |
#endif |
#endif |
35 |
|
|
36 |
|
#if VMS |
37 |
|
#include <stdlib.h> |
38 |
|
#include <unixlib.h> |
39 |
|
#else |
40 |
/* For systems with larger pointers than ints, this must be declared. */ |
/* For systems with larger pointers than ints, this must be declared. */ |
41 |
PTR malloc PARAMS ((size_t)); |
PTR malloc PARAMS ((size_t)); |
42 |
|
#endif |
43 |
|
|
44 |
static void xatexit_cleanup PARAMS ((void)); |
static void xatexit_cleanup PARAMS ((void)); |
45 |
|
|