Rev 4921 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | /* |
2 | * Copyright (c) 1990 Regents of the University of California. |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * %sccs.include.redist.c% |
||
6 | */ |
||
7 | |||
8 | /* |
||
9 | FUNCTION |
||
10 | < |
||
11 | |||
12 | INDEX |
||
13 | exit |
||
14 | |||
15 | ANSI_SYNOPSIS |
||
16 | #include |
||
17 | void exit(int <[code]>); |
||
18 | |||
19 | TRAD_SYNOPSIS |
||
20 | #include |
||
21 | void exit(<[code]>) |
||
22 | int <[code]>; |
||
23 | |||
24 | DESCRIPTION |
||
25 | Use < |
||
26 | environment. Use the argument <[code]> to pass an exit status to the |
||
27 | operating environment: two particular values, < |
||
28 | < |
||
29 | failure in a portable fashion. |
||
30 | |||
31 | < |
||
32 | program. First, it calls all application-defined cleanup functions |
||
33 | you have enrolled with < |
||
34 | cleaned up: any pending output is delivered to the host system, each |
||
35 | open file or stream is closed, and files created by < |
||
36 | deleted. |
||
37 | |||
38 | RETURNS |
||
39 | < |
||
40 | |||
41 | PORTABILITY |
||
42 | ANSI C requires < |
||
43 | < |
||
44 | |||
45 | Supporting OS subroutines required: <<_exit>>. |
||
46 | */ |
||
47 | |||
48 | #include |
||
49 | #include |
||
50 | #include |
||
51 | #include "atexit.h" |
||
52 | |||
53 | /* |
||
54 | * Exit, flushing stdio buffers if necessary. |
||
55 | */ |
||
56 | |||
57 | void |
||
58 | _DEFUN (exit, (code), |
||
59 | int code) |
||
60 | { |
||
4921 | Serge | 61 | #ifdef _LITE_EXIT |
62 | /* Refer to comments in __atexit.c for more details of lite exit. */ |
||
63 | void __call_exitprocs _PARAMS ((int, _PTR)) __attribute__((weak)); |
||
64 | if (__call_exitprocs) |
||
65 | #endif |
||
6099 | serge | 66 | __call_exitprocs (code, NULL); |
4349 | Serge | 67 | |
68 | if (_GLOBAL_REENT->__cleanup) |
||
69 | (*_GLOBAL_REENT->__cleanup) (_GLOBAL_REENT); |
||
70 | _exit (code); |
||
71 | }<_exit> |