define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / exit.c
blob2411f58023499dab823941234a45d5f9bd569dd2
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ANSI C function exit()
6 Lang: english
7 */
9 #include "__arosc_privdata.h"
11 #include <exec/types.h>
12 #include <setjmp.h>
13 #include <aros/startup.h>
15 /*****************************************************************************
17 NAME */
18 #include <stdlib.h>
20 void exit (
22 /* SYNOPSIS */
23 int code)
25 /* FUNCTION
26 Terminates the running program. The code is returned to the
27 program which has called the running program.
29 INPUTS
30 code - Exit code. 0 for success, other values for failure.
32 RESULT
33 None. This function does not return.
35 NOTES
36 This function must not be used in a shared library or
37 in a threaded application.
39 EXAMPLE
40 if (no_problems)
41 exit (0);
43 if (warning)
44 exit (5);
46 if (error)
47 exit (10);
49 if (fatal)
50 exit (20);
52 BUGS
54 SEE ALSO
55 atexit(), on_exit()
57 INTERNALS
59 ******************************************************************************/
62 __aros_startup_error = code;
64 longjmp (__aros_startup_jmp_buf, 1);
66 /* never reached */
67 } /* exit */