home · contact · privacy
460cde0fa96c95a96096c650c5e37b465bcbfb05
[plomrogue] / src / common / rexit.h
1 /* src/common/rexit.h
2  *
3  * Routines to exit the game orderly on error, with cleaning up and a somewhat
4  * informative message.
5  */
6
7 #ifndef REXIT_H
8 #define REXIT_H
9
10
11
12 /* Set "f" as the cleanup function to be called on exit. */
13 extern void set_cleanup_func(void (* f)());
14
15 /* If "err" == 0, do nothing. Else, clean up and exit with an error message that
16  * consists of "msg" or (if "msg" is NULL pointer) a generic "Details unknown"
17  * and of errno's content (if it is non-zero).
18  */
19 extern void exit_err(int err, const char * msg);
20
21 /* Do exit_err() with "msg" as: "Trouble in ".parent." with ".child."." */
22 extern void exit_trouble(int err, const char * parent, const char * child);
23
24
25
26 #endif