scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

atexit.c (213B)


      1 #include <stdlib.h>
      2 #include <errno.h>
      3 
      4 #include "../libc.h"
      5 
      6 #undef atexit
      7 
      8 int
      9 atexit(void (*fun)(void))
     10 {
     11 	if (_exitn == _ATEXIT_MAX) {
     12 		errno = ENOMEM;
     13 		return -1;
     14 	}
     15 
     16 	_exitf[_exitn++] = fun;
     17 
     18 	return 0;
     19 }