exit(0) on success, non-zero if an error occurred or signal was received

Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
Hiltjo Posthuma 2020-12-20 15:51:33 +01:00 committed by Christoph Lohmann
parent 79fcfa10f4
commit 4749f13de5

View File

@ -14,7 +14,7 @@
#include <locale.h> #include <locale.h>
char *currentslidep, **slidefiles; /* the slides */ char *currentslidep, **slidefiles; /* the slides */
int nslides, currentslide, currentslidelen; int nslides, currentslide, currentslidelen, exitstatus = 1;
void void
unloadcurrentslide(void) unloadcurrentslide(void)
@ -32,7 +32,7 @@ cleanup(int sig)
unloadcurrentslide(); unloadcurrentslide();
endwin(); /* restore terminal */ endwin(); /* restore terminal */
exit(1); exit(exitstatus);
} }
void void
@ -167,6 +167,7 @@ again:
} }
/* unmap mem */ /* unmap mem */
exitstatus = 0;
cleanup(0); cleanup(0);
return 0; return 0;