diff options
-rw-r--r-- | doc/backtick.html | 4 | ||||
-rw-r--r-- | src/execline/backtick.c | 2 | ||||
-rw-r--r-- | src/libexecline/el_execsequence.c | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/doc/backtick.html b/doc/backtick.html index 38c02a2..3081407 100644 --- a/doc/backtick.html +++ b/doc/backtick.html @@ -85,8 +85,8 @@ is set to <em>default</em>, and execution proceeds. </li> If the command line can keep running after <em>prog1</em> crashes or exits nonzero, i.e. if one of the <tt>-I</tt>, <tt>-x</tt> -or <tt>-D</tt> has been given, then <tt>backtick</tt> also adds the <tt>?</tt> variable to the -environment; it then contains an <a href="exitcodes.html">approximation</a> -of <em>prog1</em>'s exit code. +environment. If <em>prog1</em> exited normally, the variable contains its exit +code; otherwise, 256 plus the number of the signal that killed it. </p> </body> diff --git a/src/execline/backtick.c b/src/execline/backtick.c index b921d7e..e4a543b 100644 --- a/src/execline/backtick.c +++ b/src/execline/backtick.c @@ -85,6 +85,6 @@ int main (int argc, char const **argv, char const *const *envp) else allgood = 1 ; if ((!insist || allgood) && chomp && (value.s[value.len - 2] == '\n')) value.s[--value.len - 1] = 0 ; - val1[uint_fmt(val1, wait_estatus(fdwstat))] = 0 ; + val1[uint_fmt(val1, wait_status(fdwstat))] = 0 ; el_modifs_and_exec(argv + argc1 + 1, var, val, insist < 2 ? 2 : 1, doimport) ; } diff --git a/src/libexecline/el_execsequence.c b/src/libexecline/el_execsequence.c index 9d0993e..4a6cb28 100644 --- a/src/libexecline/el_execsequence.c +++ b/src/libexecline/el_execsequence.c @@ -2,6 +2,7 @@ #include <string.h> #include <unistd.h> +#include <errno.h> #include <skalibs/types.h> #include <skalibs/strerr.h> @@ -13,13 +14,14 @@ void el_execsequence (char const *const *argv1, char const *const *argv2, char const *const *envp) { size_t j = 2 ; - char fmt[UINT_FMT + 1] = "?=" ; + char fmt[UINT_FMT + 2] = "?=" ; pid_t pid = el_spawn0(argv1[0], argv1, envp) ; if (!pid) { + fmt[j++] = '1' ; + fmt[j++] = '2' ; + fmt[j++] = '6' + (errno == ENOENT) ; strerr_warnwu2sys("spawn ", argv1[0]) ; - memcpy(fmt+2, "127", 3) ; - j += 3 ; } else { |