Skip to content

Commit

Permalink
Merge pull request #888 from smazga/9front-exit
Browse files Browse the repository at this point in the history
Fix exit call on plan9/9front
  • Loading branch information
ashinn authored Feb 5, 2023
2 parents 598dcad + 27071e6 commit b297e72
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@

#ifdef PLAN9
#define exit_failure() exits("ERROR")
#define exit_success() exits(nil)
#else
#define exit_failure() exit(70)
#endif
#define exit_success() exit(0)
#endif

#if SEXP_USE_MAIN_HELP
void sexp_usage(int err) {
Expand Down Expand Up @@ -682,7 +683,16 @@ int main (int argc, char **argv) {
sexp_scheme_init();
res = run_main(argc, argv);
if (sexp_fixnump(res)) {
return sexp_unbox_fixnum(res);
int code = sexp_unbox_fixnum(res);
#ifdef PLAN9
if (code == 0) {
exit_success();
} else {
exit_failure();
}
#else
return code;
#endif
} else if (res == SEXP_FALSE) {
exit_failure();
} else {
Expand Down

0 comments on commit b297e72

Please sign in to comment.