xref: /netbsd-src/external/gpl3/gdb/dist/libiberty/atexit.c (revision 98b9484c67cdf05a7e01fa6a65d1f4f959a3633e)
1*98b9484cSchristos /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
2*98b9484cSchristos /* This function is in the public domain.  --Mike Stump. */
3*98b9484cSchristos 
4*98b9484cSchristos /*
5*98b9484cSchristos 
6*98b9484cSchristos @deftypefn Supplemental int atexit (void (*@var{f})())
7*98b9484cSchristos 
8*98b9484cSchristos Causes function @var{f} to be called at exit.  Returns 0.
9*98b9484cSchristos 
10*98b9484cSchristos @end deftypefn
11*98b9484cSchristos 
12*98b9484cSchristos */
13*98b9484cSchristos 
14*98b9484cSchristos #include "config.h"
15*98b9484cSchristos 
16*98b9484cSchristos #ifdef HAVE_ON_EXIT
17*98b9484cSchristos 
18*98b9484cSchristos int
atexit(void (* f)(void))19*98b9484cSchristos atexit(void (*f)(void))
20*98b9484cSchristos {
21*98b9484cSchristos   /* If the system doesn't provide a definition for atexit, use on_exit
22*98b9484cSchristos      if the system provides that.  */
23*98b9484cSchristos   on_exit (f, 0);
24*98b9484cSchristos   return 0;
25*98b9484cSchristos }
26*98b9484cSchristos 
27*98b9484cSchristos #endif
28