home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / exit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  1.1 KB  |  68 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: exit.c,v 1.2 1997/01/17 14:04:46 digulla Exp $
  4.  
  5.     Desc: ANSI C function exit()
  6.     Lang: english
  7. */
  8. #include <exec/types.h>
  9. #include <setjmp.h>
  10.  
  11. extern LONG __startup_error;
  12. extern jmp_buf __startup_jmp_buf;
  13.  
  14. /*****************************************************************************
  15.  
  16.     NAME */
  17. #include <stdlib.h>
  18.  
  19.     void exit (
  20.  
  21. /*  SYNOPSIS */
  22.     int code)
  23.  
  24. /*  FUNCTION
  25.     Terminates the running program. The code is returned to the
  26.     program which has called the running program.
  27.  
  28.     INPUTS
  29.     code - Exit code. 0 for success, other values for failure.
  30.  
  31.     RESULT
  32.     None. This function does not return.
  33.  
  34.     NOTES
  35.  
  36.     EXAMPLE
  37.     if (no_problems)
  38.         exit (0);
  39.  
  40.     if (warning)
  41.         exit (5);
  42.  
  43.     if (error)
  44.         exit (10);
  45.  
  46.     if (fatal)
  47.         exit (20);
  48.  
  49.     BUGS
  50.  
  51.     SEE ALSO
  52.     atexit(), on_exit()
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.     16.12.1996 digulla created
  58.  
  59. ******************************************************************************/
  60. {
  61.     __startup_error = code;
  62.  
  63.     longjmp (__startup_jmp_buf, 1);
  64.  
  65.     /* never reached */
  66. } /* exit */
  67.  
  68.