summaryrefslogtreecommitdiffstats
path: root/CRT.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-10-19 18:59:48 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-10-19 18:59:48 +0000
commit1b21827f1f875692e14ee5ac9b22f3fd69fd8593 (patch)
tree7746d8fe6864bfa47292caa65aa8fb944d1eb752 /CRT.c
parent47e881f460cfb441be64a1ff17295357fb02d0ad (diff)
Fail gracefully when /proc is not mounted
(thanks to Philipp Hagemeister)
Diffstat (limited to 'CRT.c')
-rw-r--r--CRT.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/CRT.c b/CRT.c
index 97f2144e..6cc979f7 100644
--- a/CRT.c
+++ b/CRT.c
@@ -11,8 +11,10 @@ in the source distribution for its full text.
#include "String.h"
#include <curses.h>
+#include <errno.h>
#include <signal.h>
#include <stdlib.h>
+#include <string.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
@@ -198,6 +200,13 @@ void CRT_done() {
endwin();
}
+void CRT_fatalError(const char* note) {
+ char* sysMsg = strerror(errno);
+ CRT_done();
+ fprintf(stderr, "%s: %s\n", note, sysMsg);
+ exit(2);
+}
+
int CRT_readKey() {
nocbreak();
cbreak();

© 2014-2024 Faster IT GmbH | imprint | privacy policy