home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdlib / atexit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-26  |  381 b   |  19 lines

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <stdlib.h>
  3. #include <libc/atexit.h>
  4.  
  5. int
  6. atexit(void (*a)(void))
  7. {
  8.   struct __atexit *ap;
  9.   if (a == 0)
  10.     return -1;
  11.   ap = (struct __atexit *)malloc(sizeof(struct __atexit));
  12.   if (!ap)
  13.     return -1;
  14.   ap->__next = __atexit_ptr;
  15.   ap->__function = a;
  16.   __atexit_ptr = ap;
  17.   return 0;
  18. }
  19.