use same location as .configured, etc, to store .files-touched
[AROS.git] / compiler / clib / __exitfunc.c
blob350980a342973aea638eb8fbe64095afe00f66c8
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "__arosc_privdata.h"
8 #include <aros/symbolsets.h>
9 #include <aros/startup.h>
10 #include <exec/lists.h>
11 #include "__exitfunc.h"
13 int __addexitfunc(struct AtExitNode *aen)
15 ADDHEAD((struct List *)&__atexit_list, (struct Node *)aen);
17 return 0;
20 void __callexitfuncs(void)
22 struct AtExitNode *aen;
24 while (
25 (aen = (struct AtExitNode *) REMHEAD((struct List *) &__atexit_list))
28 switch (aen->node.ln_Type)
30 case AEN_VOID:
31 aen->func.fvoid();
32 break;
34 case AEN_PTR:
35 aen->func.fptr(__aros_startup_error, aen->ptr);
36 break;
41 int __init_atexit(void)
43 NEWLIST((struct List *)&__atexit_list);
45 return 1;
48 void __exit_atexit(void)
50 if (!(__get_arosc_privdata()->acpd_flags & ACPD_NEWSTARTUP))
51 __callexitfuncs();
54 ADD2INIT(__init_atexit, 100);
55 ADD2EXIT(__exit_atexit, 100);