home · contact · privacy
License everything (GPL).
[plomrogue] / src / common / rexit.h
1 /* src/common/rexit.h
2  *
3  * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4  * or any later version. For details on its copyright, license, and warranties,
5  * see the file NOTICE in the root directory of the PlomRogue source package.
6  *
7  * Routines to exit the game orderly on error, with cleaning up and a somewhat
8  * informative message.
9  */
10
11 #ifndef REXIT_H
12 #define REXIT_H
13
14
15
16 /* Set "f" as the cleanup function to be called on exit. */
17 extern void set_cleanup_func(void (* f)());
18
19 /* If "err" == 0, do nothing. Else, clean up and exit with an error message that
20  * consists of "msg" or (if "msg" is NULL pointer) a generic "Details unknown"
21  * and of errno's content (if it is non-zero).
22  */
23 extern void exit_err(int err, const char * msg);
24
25 /* Do exit_err() with "msg" as: "Trouble in ".parent." with ".child."." */
26 extern void exit_trouble(int err, const char * parent, const char * child);
27
28
29
30 #endif