diff options
-rw-r--r-- | sysif.c | 6 | ||||
-rw-r--r-- | txr.1 | 24 |
2 files changed, 17 insertions, 13 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)); @@ -58603,28 +58603,30 @@ If the host platform fails to provide a description, the function returns .coNP Function @ exit .synb -.mets (exit << status ) +.mets (exit <> [ status ]) .syne .desc The .code exit function terminates the entire process (running \*(TX image), specifying -the termination status to the operating system. Values of +the termination status to the operating system. Values of the optional .meta status -may be +parameter may be .codn nil , .codn t , or an integer value. The value .code nil -corresponds to the C constant -.codn EXIT_FAILURE , -and +indicates an unsuccessful termination status, whereas .code t -corresponds to -.codn EXIT_SUCCESS . -These are platform-independent -indicators of failed or successful termination. The numeric value 0 also -indicates success. +indicates a successful termination status. +An absence of the +.meta status +argument also specifies a successful termination status. +If +.meta status +is an integer value, it specifies a successful termination if it is +.code 0 +otherwise the interpretation of the value is platform specific. .coNP Variables @, e2big @, eacces @, eaddrinuse @, eaddrnotavail @, eafnosupport @, eagain @, ealready @, ebadf @, ebadmsg @, ebusy @, ecanceled @, echild @, econnaborted @, econnrefused @, econnreset @, edeadlk @, edestaddrreq @, edom @, edquot @, eexist @, efault @, efbig @, ehostunreach @, eidrm @, eilseq @, einprogress @, eintr @, einval @, eio @, eisconn @, eisdir @, eloop @, emfile @, emlink @, emsgsize @, emultihop @, enametoolong @, enetdown @, enetreset @, enetunreach @, enfile @, enobufs @, enodata @, enodev @, enoent @, enoexec @, enolck @, enolink @, enomem @, enomsg @, enoprotoopt @, enospc @, enosr @, enostr @, enosys @, enotconn @, enotdir @, enotempty @, enotrecoverable @, enotsock @, enotsup @, enotty @, enxio @, eopnotsupp @, eoverflow @, eownerdead @, eperm @, epipe @, eproto @, eprotonosupport @, eprototype @, erange @, erofs @, espipe @, esrch @, estale @, etime @, etimedout @, etxtbsy @ ewouldblock and @ exdev .desc |