1 /*
2 Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3
4 Permission to use, copy, modify, and distribute this software
5 is freely granted, provided that this notice is preserved.
6 */
7 #include <stdlib.h>
8 #include <stdio.h>
9
10 void a(void);
11 void b(void);
12 void c(int, void *);
13 static void newline(void);
14
a(void)15 void a (void)
16 {
17 printf("a");
18 }
19
b(void)20 void b (void)
21 {
22 printf("b");
23 }
24
c(int code,void * k)25 void c (int code, void *k)
26 {
27 char *x = (char *)k;
28 printf("%d%c",code,x[0]);
29 }
30
newline(void)31 static void newline (void)
32 {
33 printf("\n");
34 }
35
main(void)36 int main(void)
37 {
38 if (atexit(newline) != 0)
39 abort();
40
41 if (atexit(a) != 0)
42 abort();
43
44 if (atexit(b) != 0)
45 abort();
46
47 if (on_exit(c,(void *)"c") != 0)
48 abort();
49
50 if (atexit(a) != 0)
51 abort();
52
53 exit(0);
54 }
55