atexit.c 488 B

123456789101112131415161718192021222324252627
  1. /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
  2. /* This function is in the public domain. --Mike Stump. */
  3. /*
  4. @deftypefn Supplemental int atexit (void (*@var{f})())
  5. Causes function @var{f} to be called at exit. Returns 0.
  6. @end deftypefn
  7. */
  8. #include "config.h"
  9. #ifdef HAVE_ON_EXIT
  10. int
  11. atexit(void (*f)(void))
  12. {
  13. /* If the system doesn't provide a definition for atexit, use on_exit
  14. if the system provides that. */
  15. on_exit (f, 0);
  16. return 0;
  17. }
  18. #endif