Subversion Repositories Kolibri OS

Rev

Rev 1906 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1906 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
<>---end program execution
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 <> to return control from a program to the host operating
26
environment.  Use the argument <[code]> to pass an exit status to the
27
operating environment: two particular values, <> and
28
<>, are defined in `<>' to indicate success or
29
failure in a portable fashion.
30
 
31
<> does two kinds of cleanup before ending execution of your
32
program.  First, it calls all application-defined cleanup functions
33
you have enrolled with <>.  Second, files and streams are
34
cleaned up: any pending output is delivered to the host system, each
35
open file or stream is closed, and files created by <> are
36
deleted.
37
 
38
RETURNS
39
<> does not return to its caller.
40
 
41
PORTABILITY
42
ANSI C requires <>, and specifies that <> and
43
<> must be defined.
44
 
45
Supporting OS subroutines required: <<_exit>>.
46
*/
47
 
48
#include 
49
#include 	/* for _exit() declaration */
50
#include 
51
#include "atexit.h"
52
 
53
/*
54
 * Exit, flushing stdio buffers if necessary.
55
 */
56
 
3065 serge 57
void
1906 serge 58
_DEFUN (exit, (code),
59
	int code)
60
{
61
  __call_exitprocs (code, NULL);
62
 
63
  if (_GLOBAL_REENT->__cleanup)
64
    (*_GLOBAL_REENT->__cleanup) (_GLOBAL_REENT);
65
  _exit (code);
66
}