diff options
-rw-r--r-- | doc/forbacktickx.html | 6 | ||||
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/upgrade.html | 6 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/execline/forbacktickx.c | 23 | ||||
-rw-r--r-- | src/execline/forstdin.c | 12 |
6 files changed, 40 insertions, 11 deletions
diff --git a/doc/forbacktickx.html b/doc/forbacktickx.html index d20bb72..4398b64 100644 --- a/doc/forbacktickx.html +++ b/doc/forbacktickx.html @@ -78,9 +78,11 @@ split <em>x</em>. </li> <ul> <li> You can start <em>loop...</em> with "import -u <em>variable</em>" to perform variable substitution. </li> - <li> forbacktickx is now implemented as a trivial wrapper around the + <li> forbacktickx is now implemented as a wrapper around the <a href="pipeline.html">pipeline</a> and -<a href="forstdin.html">forstdin</a> commands. </li> +<a href="forstdin.html">forstdin</a> commands, with calls to +<a href="fdmove.html">fdmove></a> to ensure that <em>loop...</em> is called +with the proper standard input. </li> </ul> </body> diff --git a/doc/index.html b/doc/index.html index 1fdb782..ec95332 100644 --- a/doc/index.html +++ b/doc/index.html @@ -67,7 +67,7 @@ library. </li> <h3> Download </h3> <ul> - <li> The current released version of execline is <a href="execline-2.1.2.1.tar.gz">2.1.2.1</a>. </li> + <li> The current released version of execline is <a href="execline-2.1.2.2.tar.gz">2.1.2.2</a>. </li> <li> Alternatively, you can checkout a copy of the execline git repository: <pre> git clone git://git.skarnet.org/execline </pre> </li> </ul> diff --git a/doc/upgrade.html b/doc/upgrade.html index 28bf1bc..148c692 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,12 @@ <h1> What has changed in execline </h1> +<h2> in 2.1.2.2 </h2> + +<ul> + <li> Bugfix release, no changes </li> +</ul> + <h2> in 2.1.2.1 </h2> <ul> diff --git a/package/info b/package/info index 83b228b..b6faa04 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=execline -version=2.1.2.1 +version=2.1.2.2 category=admin package_macro_name=EXECLINE diff --git a/src/execline/forbacktickx.c b/src/execline/forbacktickx.c index 0e58106..9301581 100644 --- a/src/execline/forbacktickx.c +++ b/src/execline/forbacktickx.c @@ -1,6 +1,9 @@ /* ISC license. */ +#include <unistd.h> +#include <errno.h> #include <skalibs/ushort.h> +#include <skalibs/uint.h> #include <skalibs/bytestr.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> @@ -62,7 +65,14 @@ int main (int argc, char const **argv, char const *const *envp) if (!argv[1][0]) strerr_dief1x(100, "empty block") ; { unsigned int m = 0, i = 1 ; - char const *newargv[argc + 15] ; + int fd = dup(0) ; + char const *newargv[argc + 18] ; + char fmt[UINT_FMT] ; + if (fd < 0) + { + if (errno != EBADF) strerr_diefu1sys(111, "dup stdin") ; + } + else fmt[uint_fmt(fmt, (unsigned int)fd)] = 0 ; newargv[m++] = EXECLINE_BINPREFIX "pipeline" ; newargv[m++] = "--" ; while (argv[i] && argv[i][0] != EXECLINE_BLOCK_END_CHAR && (!EXECLINE_BLOCK_END_CHAR || (argv[i][0] && argv[i][1]))) @@ -88,6 +98,17 @@ int main (int argc, char const **argv, char const *const *envp) } newargv[m++] = "--" ; newargv[m++] = argv[0] ; + if (fd < 0) + { + newargv[m++] = EXECLINE_BINPREFIX "fdclose" ; + newargv[m++] = "0" ; + } + else + { + newargv[m++] = EXECLINE_BINPREFIX "fdmove" ; + newargv[m++] = "0" ; + newargv[m++] = fmt ; + } while (argv[i]) newargv[m++] = argv[i++] ; newargv[m++] = 0 ; pathexec_run(newargv[0], newargv, envp) ; diff --git a/src/execline/forstdin.c b/src/execline/forstdin.c index 1e9d5e6..3fb52eb 100644 --- a/src/execline/forstdin.c +++ b/src/execline/forstdin.c @@ -147,11 +147,11 @@ int main (int argc, char const **argv, char const *const *envp) stralloc_free(&modif) ; } if (pids.s) - { - if (sig_restore(SIGCHLD) < 0) - strerr_diefu2sys(111, "restore", " SIGCHLD handler") ; - if (!waitn(genalloc_s(pid_t, &pids), genalloc_len(pid_t, &pids))) - strerr_diefu1sys(111, "waitn") ; - } + for (;;) + { + sig_block(SIGCHLD) ; + if (!pids.len) break ; + sig_pause() ; + } return 0 ; } |