home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * EXIT.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- */
-
- #include <stdio.h>
- #include <lib/atexit.h>
- #include <libraries/dosextens.h>
-
- typedef struct Process Process;
-
- extern long *__MemList;
- extern void *_WBMsg;
- AtExit *_ExitBase;
-
- void
- exit(code)
- int code;
- {
- {
- AtExit *eb;
- for (eb = _ExitBase; eb; eb = eb->Next)
- (*eb->Func)();
- }
-
- fclose(stdin);
- fclose(stdout);
- fclose(stderr);
-
- /*
- * stdio
- */
-
- while (_Iod)
- fclose(_Iod);
-
- /*
- * file descriptors
- */
-
- __closeall();
-
- /*
- * low level exit (handles allocated memory & workbench)
- */
-
- if (_WBMsg) {
- Forbid();
- ReplyMsg(_WBMsg);
- }
- _exit(code);
- }
-
-