shithub: scc

ref: 349ceccbc07453503347623eea9476c815473d01
dir: /src/libc/stdlib/atexit.c/

View raw version
#include <stdlib.h>
#include <errno.h>

#include "../libc.h"

#undef atexit

int
atexit(void (*fun)(void))
{
	if (_exitn == _ATEXIT_MAX) {
		errno = ENOMEM;
		return -1;
	}

	_exitf[_exitn++] = fun;

	return 0;
}