From 7914b82edaf2df6c402ca3258314a2aabad58251 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 26 Aug 2013 02:54:35 +0200
Subject: [PATCH] exit_err() now also prints the internal error code.

---
 src/rexit.c | 3 ++-
 src/rexit.h | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/rexit.c b/src/rexit.c
index 31cf3ee..71ec130 100644
--- a/src/rexit.c
+++ b/src/rexit.c
@@ -72,7 +72,8 @@ extern void exit_err(uint8_t err, struct World * world, char * msg)
     {
         msg = "Details unknown.";
     }
-    printf("Aborted PlomRogue due to error. %s\n", msg);
+    printf("Aborted PlomRogue due to error. %s\nInternal error code: %d\n",
+           msg, err);
     if (0 != errno)
     {
         perror("errno states");
diff --git a/src/rexit.h b/src/rexit.h
index ac85577..d9d93b2 100644
--- a/src/rexit.h
+++ b/src/rexit.h
@@ -36,9 +36,8 @@ extern void exit_game(struct World * world);
 
 
 /* If "err" != 0, exit with an error message "msg" and clean up. If "msg" is a
- * NULL pointer, return generic error message. (For "err", pass the result of
- * functions that return non-zero as an error status and thereby avoid bloating
- * up the code with if-error-conditionals.)
+ * NULL pointer, return generic "Details unknown". In any case, also print "err"
+ * as the "internal error code". Also print errno if it is non-zero.
  */
 extern void exit_err(uint8_t err, struct World * world, char * msg);
 
-- 
2.30.2