1 /* src/common/rexit.c */
4 #include <errno.h> /* global errno */
5 #include <stdint.h> /* uint16_t */
6 #include <stdio.h> /* printf(), perror(), sprintf() */
7 #include <stdlib.h> /* exit(), EXIT_FAILURE */
8 #include <string.h> /* strlen() */
12 void (* cleanup_func) ();
16 extern void set_cleanup_func(void (* f)())
23 extern void exit_err(int err, char * msg)
32 msg = "Details unknown.";
34 printf("Aborted program due to error. %s\n", msg);
37 perror("errno states");
44 extern void exit_trouble(int err, char * parent, char * child)
46 char * p1 = "Trouble in ";
49 uint16_t size = strlen(p1) + strlen(parent) + strlen(p2) + strlen(child)
52 sprintf(msg, "%s%s%s%s%s", p1, parent, p2, child, p3);