X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Frexit.c;h=cb69ccd842c9275f41067e6704ae523bea9dfa60;hb=9e12416aa36cc77957627900c2c1fc0055936504;hp=73d740ba4bd8e8d4e55809758dc9b1d000818dea;hpb=9cc02529df358c0cc32ca1b1cde9c327204a5183;p=plomrogue diff --git a/src/rexit.c b/src/rexit.c index 73d740b..cb69ccd 100644 --- a/src/rexit.c +++ b/src/rexit.c @@ -2,13 +2,14 @@ #include "rexit.h" #include /* for exit(), free(), defines EXIT_SUCESS, EXIT_FAILURE */ -#include /* for printf() */ +#include /* for printf(), perror() */ #include /* for uint8_t */ #include /* for endwin() */ #include "main.h" /* for World struct */ #include "map.h" /* for Map struct */ #include "keybindings.h" /* for KeysWinData, KeyBinding structs */ +#include "errno.h" /* The clean-up routine and the flag resource by which it decides what to do. */ @@ -67,6 +68,12 @@ extern void exit_err(uint8_t err, struct World * world, char * msg) return; } cleanup(world); + if (NULL == msg) + { + msg = "Some error encountered. Aborted."; + } printf("%s\n", msg); + errno = 0; + perror("errno states"); exit(EXIT_FAILURE); }