summaryrefslogtreecommitdiff
path: root/gramscii.c
diff options
context:
space:
mode:
Diffstat (limited to 'gramscii.c')
-rw-r--r--gramscii.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/gramscii.c b/gramscii.c
index 9a6ef59..6b40009 100644
--- a/gramscii.c
+++ b/gramscii.c
@@ -39,11 +39,7 @@ void cleanup(int s){
dump_lines(screen, stdout);
tcsetattr(0, TCSANOW, &t1);
fflush(stdout);
- exit(0);
-}
-
-void exit_cleanup(void){
- cleanup(0);
+ exit(s);
}
/*** Initialisation ***/
@@ -54,7 +50,6 @@ void init(){
signal(SIGINT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGQUIT, cleanup);
- atexit(exit_cleanup);
tcgetattr(0, &t1);
t2 = t1;
@@ -132,7 +127,7 @@ void commands(FILE *fc){
case 'q':
check_modified(fc);/** FALLTHROUGH **/
case 'Q':
- exit(0);
+ cleanup(0);
break;
}
}
@@ -147,7 +142,7 @@ void commands(FILE *fc){
void usage(){
fprintf(stderr, "Usage: %s [-s] [-h] [file ...]\n", argv0);
- exit(1);
+ cleanup(1);
}