Merge branch 'master' of github.com:ashinn/chibi-scheme

This commit is contained in:
Alex Shinn 2023-02-08 09:38:17 +09:00
commit 8e9b15eda8

14
main.c
View file

@ -25,10 +25,11 @@
#ifdef PLAN9 #ifdef PLAN9
#define exit_failure() exits("ERROR") #define exit_failure() exits("ERROR")
#define exit_success() exits(nil)
#else #else
#define exit_failure() exit(70) #define exit_failure() exit(70)
#endif
#define exit_success() exit(0) #define exit_success() exit(0)
#endif
#if SEXP_USE_MAIN_HELP #if SEXP_USE_MAIN_HELP
void sexp_usage(int err) { void sexp_usage(int err) {
@ -682,7 +683,16 @@ int main (int argc, char **argv) {
sexp_scheme_init(); sexp_scheme_init();
res = run_main(argc, argv); res = run_main(argc, argv);
if (sexp_fixnump(res)) { 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) { } else if (res == SEXP_FALSE) {
exit_failure(); exit_failure();
} else { } else {