shithub: scc

ref: 020a6282c06e9f61517d8a37495d888ec7527808
dir: /libc/src/exit.c/

View raw version
/* See LICENSE file for copyright and license details. */

#include <stdlib.h>
#undef exit

void (*_atexitf[_ATEXIT_MAX])(void);

void
exit(int status)
{
	void (**bp)(void);
	int i;

	for (i = _ATEXIT_MAX-1; i >= 0; --i) {
		if (bp = _atexit[i]) {
			*_atexit[i] = NULL;
			(*bp)();
		}
	}
	_Exit(status);
}