/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#if defined(_UWIN) && defined(_BLD_ast)2223void _STUB_vmexit(){}2425#else2627#include "vmhdr.h"2829/*30** Any required functions for process exiting.31** Written by Kiem-Phong Vo, [email protected] (05/25/93).32*/33#if _PACKAGE_ast || _lib_atexit3435void _STUB_vmexit(){}3637#else3839#if _lib_onexit4041#if __STD_C42int atexit(void (*exitf)(void))43#else44int atexit(exitf)45void (*exitf)();46#endif47{48return onexit(exitf);49}5051#else /*!_lib_onexit*/5253typedef struct _exit_s54{ struct _exit_s* next;55void(* exitf)_ARG_((void));56} Exit_t;57static Exit_t* Exit;5859#if __STD_C60atexit(void (*exitf)(void))61#else62atexit(exitf)63void (*exitf)();64#endif65{ Exit_t* e;6667if(!(e = (Exit_t*)malloc(sizeof(Exit_t))) )68return -1;69e->exitf = exitf;70e->next = Exit;71Exit = e;72return 0;73}7475#if __STD_C76void exit(int type)77#else78void exit(type)79int type;80#endif81{82Exit_t* e;8384for(e = Exit; e; e = e->next)85(*e->exitf)();8687#if _exit_cleanup88_cleanup();89#endif9091_exit(type);92return type;93}9495#endif /* _lib_onexit || _lib_on_exit */9697#endif /*!PACKAGE_ast*/9899#endif100101102