xref: /netbsd-src/external/gpl2/xcvs/dist/lib/atexit.c (revision 5a6c14c844c4c665da5632061aebde7bb2cb5766)
1 /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
2 /* This function is in the public domain.  --Mike Stump. */
3 #include <sys/cdefs.h>
4 __RCSID("$NetBSD: atexit.c,v 1.2 2016/05/17 14:00:09 christos Exp $");
5 
6 #ifdef HAVE_CONFIG_H
7 # include <config.h>
8 #endif
9 
10 int
atexit(void (* f)(void))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