1N/A/***********************************************************************
1N/A* *
1N/A* This software is part of the ast package *
1N/A* Copyright (c) 1985-2011 AT&T Intellectual Property *
1N/A* and is licensed under the *
1N/A* Common Public License, Version 1.0 *
1N/A* by AT&T Intellectual Property *
1N/A* *
1N/A* A copy of the License is available at *
1N/A* http://www.opensource.org/licenses/cpl1.0.txt *
1N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
1N/A* *
1N/A* Information and Software Systems Research *
1N/A* AT&T Research *
1N/A* Florham Park NJ *
1N/A* *
1N/A* Glenn Fowler <gsf@research.att.com> *
1N/A* David Korn <dgk@research.att.com> *
1N/A* Phong Vo <kpv@research.att.com> *
1N/A* *
1N/A***********************************************************************/
1N/A#if defined(_UWIN)
1N/A
1N/Avoid _STUB_vmexit(){}
1N/A
1N/A#else
1N/A
1N/A#include "vmhdr.h"
1N/A
1N/A/*
1N/A** Any required functions for process exiting.
1N/A** Written by Kiem-Phong Vo, kpv@research.att.com (05/25/93).
1N/A*/
1N/A#if _PACKAGE_ast || _lib_atexit
1N/A
1N/Avoid _STUB_vmexit(){}
1N/A
1N/A#else
1N/A
1N/A#if _lib_onexit
1N/A
1N/A#if __STD_C
1N/Aint atexit(void (*exitf)(void))
1N/A#else
1N/Aint atexit(exitf)
1N/Avoid (*exitf)();
1N/A#endif
1N/A{
1N/A return onexit(exitf);
1N/A}
1N/A
1N/A#else /*!_lib_onexit*/
1N/A
1N/Atypedef struct _exit_s
1N/A{ struct _exit_s* next;
1N/A void(* exitf)_ARG_((void));
1N/A} Exit_t;
1N/Astatic Exit_t* Exit;
1N/A
1N/A#if __STD_C
1N/Aatexit(void (*exitf)(void))
1N/A#else
1N/Aatexit(exitf)
1N/Avoid (*exitf)();
1N/A#endif
1N/A{ Exit_t* e;
1N/A
1N/A if(!(e = (Exit_t*)malloc(sizeof(Exit_t))) )
1N/A return -1;
1N/A e->exitf = exitf;
1N/A e->next = Exit;
1N/A Exit = e;
1N/A return 0;
1N/A}
1N/A
1N/A#if __STD_C
1N/Avoid exit(int type)
1N/A#else
1N/Avoid exit(type)
1N/Aint type;
1N/A#endif
1N/A{
1N/A Exit_t* e;
1N/A
1N/A for(e = Exit; e; e = e->next)
1N/A (*e->exitf)();
1N/A
1N/A#if _exit_cleanup
1N/A _cleanup();
1N/A#endif
1N/A
1N/A _exit(type);
1N/A return type;
1N/A}
1N/A
1N/A#endif /* _lib_onexit || _lib_on_exit */
1N/A
1N/A#endif /*!PACKAGE_ast*/
1N/A
1N/A#endif