exit.c

Go to the documentation of this file.
00001 /*
00002  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
00003  * See the copyright notice in the ACK home directory, in the file "Copyright".
00004  */
00005 /* $Header: /opt/proj/minix/cvsroot/src/lib/ansi/exit.c,v 1.1.1.1 2005/04/21 14:56:04 beng Exp $ */
00006 
00007 #include        <stdio.h>
00008 #include        <stdlib.h>
00009 
00010 #define NEXITS  32
00011 
00012 void (*__functab[NEXITS])(void);
00013 int __funccnt = 0;
00014 
00015 extern void _exit(int);
00016 
00017 /* only flush output buffers when necessary */
00018 int (*_clean)(void) = NULL;
00019 
00020 static void
00021 _calls(void)
00022 {
00023         register int i = __funccnt;
00024         
00025         /* "Called in reversed order of their registration" */
00026         while (--i >= 0)
00027                 (*__functab[i])();
00028 }
00029 
00030 void
00031 exit(int status)
00032 {
00033         _calls();
00034         if (_clean) _clean();
00035         _exit(status) ;
00036 }

Generated on Fri Apr 14 22:57:25 2006 for minix by  doxygen 1.4.6