diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-06-20 12:23:14 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-06-20 12:23:14 -0700 |
commit | 432dac666c1b87bfee9a6eeefbb05908d465d420 (patch) | |
tree | c64ed09ab00019433b6e90d4aae43105be6798ee /sysif.c | |
parent | bc7d7b8843c84103e22e8080d069dfa6a52fb463 (diff) | |
download | txr-432dac666c1b87bfee9a6eeefbb05908d465d420.tar.gz txr-432dac666c1b87bfee9a6eeefbb05908d465d420.tar.bz2 txr-432dac666c1b87bfee9a6eeefbb05908d465d420.zip |
exit: argument becomes optional
* sysif.c (exit_wrap): Check for missing status argument, and
map to EXIT_SUCCESS.
(sysif_init): Register exit as having optional argument.
* txr.1: Update documentation regarding optional argument of
exit. Also, EXIT_SUCCESS and EXIT_FAILURE are no longer
mentioned, only that t maps to succes and nil to failure.
Diffstat (limited to 'sysif.c')
-rw-r--r-- | sysif.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -173,7 +173,9 @@ static val exit_wrap(val status) { int stat; - if (status == nil) + if missingp(status) + stat = EXIT_SUCCESS; + else if (status == nil) stat = EXIT_FAILURE; else if (status == t) stat = EXIT_SUCCESS; @@ -2348,7 +2350,7 @@ void sysif_init(void) reg_fun(intern(lit("errno"), user_package), func_n1o(errno_wrap, 0)); reg_fun(intern(lit("strerror"), user_package), func_n1o(strerror_wrap, 0)); - reg_fun(intern(lit("exit"), user_package), func_n1(exit_wrap)); + reg_fun(intern(lit("exit"), user_package), func_n1o(exit_wrap, 0)); reg_fun(intern(lit("at-exit-call"), user_package), func_n1(at_exit_call)); reg_fun(intern(lit("at-exit-do-not-call"), user_package), func_n1(at_exit_do_not_call)); reg_fun(intern(lit("abort"), user_package), func_n0(abort_wrap)); |