home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_08 / 1008012b < prev    next >
Text File  |  1992-06-12  |  339b  |  19 lines

  1.  
  2. Listing 2 -- atexit.c
  3.  
  4. /* atexit function */
  5. #include <stdlib.h>
  6.  
  7.         /* external declarations */
  8. extern void (*_Atfuns[])(void);
  9. extern size_t _Atcount;
  10.  
  11. int (atexit)(void (*func)(void))
  12.     {    /* function to call at exit */
  13.     if (_Atcount == 0)
  14.         return (-1);    /* list is full */
  15.     _Atfuns[--_Atcount] = func;
  16.     return (0);
  17.     }
  18.  
  19.