branch update for HEAD-2003021201
[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 void exit(int status) 
10 {
11   //int i;
12   struct __atexit *a = __atexit_ptr;
13   __atexit_ptr = 0; /* to prevent infinite loops */
14   while (a)
15   {
16     (a->__function)();
17     a = a->__next;
18   }
19 /*
20   if (__stdio_cleanup_hook)
21     __stdio_cleanup_hook();
22   for (i=0; i<djgpp_last_dtor-djgpp_first_dtor; i++)
23     djgpp_first_dtor[i]();
24 */
25   /* in case the program set it this way */
26   _setmode(0, O_TEXT);
27   _exit(status);
28   for(;;);
29 }
30
31
32 void _exit(int _status)
33 {
34         ExitProcess(_status);
35         for(;;);
36 }
37
38 void _cexit( void )
39 {
40         // flush
41 }
42
43 void _c_exit( void )
44 {
45         // reset interup vectors
46 }