00001 /* xexit.c -- Run any exit handlers, then exit. 00002 Copyright (C) 1994, 95, 1997 Free Software Foundation, Inc. 00003 00004 This file is part of the libiberty library. 00005 Libiberty is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 Libiberty is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with libiberty; see the file COPYING.LIB. If not, write 00017 to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. */ 00019 00020 /* 00021 00022 @deftypefn Replacement void xexit (int @var{code}) 00023 00024 Terminates the program. If any functions have been registered with 00025 the @code{xatexit} replacement function, they will be called first. 00026 Termination is handled via the system's normal @code{exit} call. 00027 00028 @end deftypefn 00029 00030 */ 00031 00032 #ifdef HAVE_CONFIG_H 00033 #include "config.h" 00034 #endif 00035 #include <stdio.h> 00036 #ifdef HAVE_STDLIB_H 00037 #include <stdlib.h> 00038 #endif 00039 #include "libiberty.h" 00040 00041 00042 /* This variable is set by xatexit if it is called. This way, xmalloc 00043 doesn't drag xatexit into the link. */ 00044 void (*_xexit_cleanup) PARAMS ((void)); 00045 00046 void 00047 xexit (code) 00048 int code; 00049 { 00050 if (_xexit_cleanup != NULL) 00051 (*_xexit_cleanup) (); 00052 exit (code); 00053 }
1.5.6