Introduce old redir program
[lcapit-junk-code.git] / books / apue / atexit.c
blob5ebeb629da8a97f310fc54967af8f418d73ce066
1 /*
2 * atexit() example usage
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
8 static void my_exit1(void)
10 printf("first exit handler\n");
13 static void my_exit2(void)
15 printf("second exit handler\n");
18 int main(void)
20 if (atexit(my_exit2) != 0)
21 fprintf(stderr, "can't register my_exit2");
22 if (atexit(my_exit1) != 0)
23 fprintf(stderr, "can't register my_exit1");
24 if (atexit(my_exit1) != 0)
25 fprintf(stderr, "can't register my_exit1");
27 printf("main is done\n");
28 return 0;