update for HEAD-2003091401
[reactos.git] / lib / crtdll / stdlib / _exit.c
1 #include <windows.h>
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/io.h>
4 #include <msvcrt/fcntl.h>
5 #include <msvcrt/internal/atexit.h>
6
7 struct __atexit *__atexit_ptr = 0;
8
9 /*
10  * @implemented
11  */
12 void exit(int status) 
13 {
14   //int i;
15   struct __atexit *a = __atexit_ptr;
16   __atexit_ptr = 0; /* to prevent infinite loops */
17   while (a)
18   {
19     (a->__function)();
20     a = a->__next;
21   }
22 /*
23   if (__stdio_cleanup_hook)
24     __stdio_cleanup_hook();
25   for (i=0; i<djgpp_last_dtor-djgpp_first_dtor; i++)
26     djgpp_first_dtor[i]();
27 */
28   /* in case the program set it this way */
29   _setmode(0, O_TEXT);
30   _exit(status);
31   for(;;);
32 }
33
34
35 /*
36  * @implemented
37  */
38 void _exit(int _status)
39 {
40         ExitProcess(_status);
41         for(;;);
42 }
43
44 /*
45  * @unimplemented
46  */
47 void _cexit( void )
48 {
49         // flush
50 }
51
52 /*
53  * @unimplemented
54  */
55 void _c_exit( void )
56 {
57         // reset interup vectors
58 }