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"
35 "Internal error code: %d\n",
39 perror("errno states");
46 extern void exit_trouble(int err, char * parent, char * child)
48 char * p1 = "Trouble in ";
51 uint16_t size = strlen(p1) + strlen(parent) + strlen(p2) + strlen(child)
54 sprintf(msg, "%s%s%s%s%s", p1, parent, p2, child, p3);