Merge pull request #888 from smazga/9front-exit

Fix exit call on plan9/9front
This commit is contained in:
Alex Shinn 2023-02-05 09:48:29 +09:00 committed by GitHub
commit b297e7272b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

14
main.c
View file

@ -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) {
@ -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 {