|
|
1.1 root 1: /*
2: * libc/stdio/exit.c
3: * C general utilities library.
4: * exit()
5: * ANSI 4.10.4.3.
6: * Normal termination.
7: * Implementation defined behavior:
8: * successful termination (status==0 or status==EXIT_SUCCESS) returns 0
9: * unsuccessful termination (status==EXIT_FAILURE) returns 1
10: * otherwise (status!=EXIT_SUCCESS && status!=EXIT_FAILURE) returns status
11: * This just passes the given status to the system,
12: * which works since EXIT_SUCCESS is 0 and EXIT_FAILURE is 1.
13: * Should be in libc/stdlib/exit.c but is in libc/stdio/exit.c instead
14: * because the order of objects in the library is significant,
15: * cf. libc/stdio/Makefile.
16: */
17:
18: #include <stdio.h>
19: #include <stdlib.h>
20:
21: void (**_atexitfp)(); /* pointer to last atexit-registered function */
22: int _atexitn; /* count of atexit-registered functions */
23:
24: void
25: exit(status)
26: {
27: while (_atexitn-- > 0)
28: (**--_atexitfp)(); /* Execute registered functions */
29: _finish(); /* Close open streams */
30: _exit(status); /* Return status */
31: }
32:
33: /* end of libc/stdio/exit.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.