diff options
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | doc/fdswap.html | 43 | ||||
-rw-r--r-- | doc/index.html | 5 | ||||
-rw-r--r-- | doc/upgrade.html | 7 | ||||
-rw-r--r-- | package/deps.mak | 3 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | package/modes | 1 | ||||
-rw-r--r-- | package/targets.mak | 1 | ||||
-rw-r--r-- | src/execline/deps-exe/fdswap | 1 | ||||
-rw-r--r-- | src/execline/fdswap.c | 19 | ||||
-rw-r--r-- | src/execline/multisubstitute.c | 5 |
11 files changed, 81 insertions, 8 deletions
diff --git a/INSTALL b/INSTALL index 09a8be5..dda0e02 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 4.0 or later - - skalibs version 2.2.0.0 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.2.1.0 or later: http://skarnet.org/software/skalibs/ This software will run on any operating system that implements POSIX.1-2008, available at: diff --git a/doc/fdswap.html b/doc/fdswap.html new file mode 100644 index 0000000..5f353dc --- /dev/null +++ b/doc/fdswap.html @@ -0,0 +1,43 @@ +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <title>execline: the fdswap program</title> + <meta name="Description" content="execline: the fdswap program" /> + <meta name="Keywords" content="execline command fdswap file descriptor dup dup2" /> + <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> --> + </head> +<body> + +<p> +<a href="index.html">execline</a><br /> +<a href="http://skarnet.org/software/">Software</a><br /> +<a href="http://skarnet.org/">skarnet.org</a> +</p> + +<h1> The <tt>fdswap</tt> program </h1> + +<p> +<tt>fdswap</tt> swaps two file descriptors, then +executes a program. +</p> + +<h2> Interface </h2> + +<pre> + fdswap <em>fd1</em> <em>fd2</em> <em>prog...</em> +</pre> + +<p> +<tt>fdswaps</tt> swaps file descriptors numbered <em>fd1</em> and +<em>fd2</em>, then execs into <em>prog</em> with its arguments. +</p> + +<h2> Notes </h2> + +<ul> + <li> fdswap has no portable shell equivalent. </li> +</ul> + +</body> +</html> diff --git a/doc/index.html b/doc/index.html index 462eeba..851a0c5 100644 --- a/doc/index.html +++ b/doc/index.html @@ -50,7 +50,7 @@ shell's syntax, and has no security issues. <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 4.0 or later </li> <li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version -2.2.0.0 or later </li> +2.2.1.0 or later </li> </ul> <h3> Licensing </h3> @@ -63,7 +63,7 @@ shell's syntax, and has no security issues. <h3> Download </h3> <ul> - <li> The current released version of execline is <a href="execline-2.0.1.1.tar.gz">2.0.1.1</a>. </li> + <li> The current released version of execline is <a href="execline-2.0.2.0.tar.gz">2.0.2.0</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> @@ -122,6 +122,7 @@ to your installation: the shebang lines for your system might be something like <li><a href="fdclose.html">The <tt>fdclose</tt> program</a></li> <li><a href="fdblock.html">The <tt>fdblock</tt> program</a></li> <li><a href="fdmove.html">The <tt>fdmove</tt> program</a></li> +<li><a href="fdswap.html">The <tt>fdswap</tt> program</a></li> <li><a href="fdreserve.html">The <tt>fdreserve</tt> program</a></li> <li><a href="redirfd.html">The <tt>redirfd</tt> program</a></li> <li><a href="piperw.html">The <tt>piperw</tt> program</a></li> diff --git a/doc/upgrade.html b/doc/upgrade.html index eed4a6a..ed85109 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -17,6 +17,13 @@ <h1> What has changed in execline </h1> +<h2> in 2.0.2.0 </h2> + +<ul> + <li> skalibs dependency bumped to 2.2.1.0 </li> + <li> New command: <a href="fdswap.html">fdswap</a> </li> +</ul> + <h2> in 2.0.1.1 </h2> <ul> diff --git a/package/deps.mak b/package/deps.mak index 1794379..4bf3d89 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -19,6 +19,7 @@ src/execline/fdblock.o src/execline/fdblock.lo: src/execline/fdblock.c src/execline/fdclose.o src/execline/fdclose.lo: src/execline/fdclose.c src/execline/fdmove.o src/execline/fdmove.lo: src/execline/fdmove.c src/execline/fdreserve.o src/execline/fdreserve.lo: src/execline/fdreserve.c +src/execline/fdswap.o src/execline/fdswap.lo: src/execline/fdswap.c src/execline/forbacktickx.o src/execline/forbacktickx.lo: src/execline/forbacktickx.c src/include/execline/config.h src/include/execline/execline.h src/execline/foreground.o src/execline/foreground.lo: src/execline/foreground.c src/include/execline/execline.h src/execline/forx.o src/execline/forx.lo: src/execline/forx.c src/include/execline/config.h src/include/execline/execline.h @@ -99,6 +100,8 @@ fdmove: private EXTRA_LIBS := fdmove: src/execline/fdmove.o -lskarnet fdreserve: private EXTRA_LIBS := fdreserve: src/execline/fdreserve.o -lskarnet +fdswap: private EXTRA_LIBS := +fdswap: src/execline/fdswap.o -lskarnet forbacktickx: private EXTRA_LIBS := forbacktickx: src/execline/forbacktickx.o ${LIBEXECLINE} -lskarnet foreground: private EXTRA_LIBS := diff --git a/package/info b/package/info index 9856244..c1621d8 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=execline -version=2.0.1.1 +version=2.0.2.0 category=admin package_macro_name=EXECLINE diff --git a/package/modes b/package/modes index 29e242a..332d2c0 100644 --- a/package/modes +++ b/package/modes @@ -17,6 +17,7 @@ fdblock 0755 fdclose 0755 fdreserve 0755 fdmove 0755 +fdswap 0755 forx 0755 forbacktickx 0755 foreground 0755 diff --git a/package/targets.mak b/package/targets.mak index 6f58541..2b1c0f4 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -15,6 +15,7 @@ export \ fdblock \ fdclose \ fdmove \ +fdswap \ fdreserve \ forbacktickx \ foreground \ diff --git a/src/execline/deps-exe/fdswap b/src/execline/deps-exe/fdswap new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/execline/deps-exe/fdswap @@ -0,0 +1 @@ +-lskarnet diff --git a/src/execline/fdswap.c b/src/execline/fdswap.c new file mode 100644 index 0000000..13ac98b --- /dev/null +++ b/src/execline/fdswap.c @@ -0,0 +1,19 @@ +/* ISC license. */ + +#include <unistd.h> +#include <skalibs/uint.h> +#include <skalibs/strerr2.h> +#include <skalibs/djbunix.h> + +#define USAGE "fdswap fd1 fd2 prog..." + +int main (int argc, char const *const *argv, char const *const *envp) +{ + unsigned int fd1, fd2 ; + PROG = "fdswap" ; + if ((argc < 4) || !uint0_scan(argv[1], &fd1) || !uint0_scan(argv[2], &fd2)) + strerr_dieusage(100, USAGE) ; + if (fd_move2(fd1, fd2, fd2, fd1) < 0) strerr_diefu1sys(111, "swap fds") ; + pathexec_run(argv[3], argv+3, envp) ; + strerr_dieexec(111, argv[3]) ; +} diff --git a/src/execline/multisubstitute.c b/src/execline/multisubstitute.c index acee42f..d7fbb4e 100644 --- a/src/execline/multisubstitute.c +++ b/src/execline/multisubstitute.c @@ -18,7 +18,7 @@ static char const *const commands[8] = 0 } ; -static exlsnfunc_t *const functions[8] = +static exlsnfunc_t_ref const functions[8] = { &exlsn_define, &exlsn_importas, @@ -36,12 +36,10 @@ int main (int argc, char const **argv, char const *const *envp) PROG = "multisubstitute" ; if (!--argc) strerr_dieusage(100, USAGE) ; - /* Read a block containing directives */ argc1 = el_semicolon(++argv) ; if (argc1 >= argc) strerr_dief1x(100, "unterminated block") ; if (argc1 + 1 == argc) strerr_dieusage(100, USAGE) ; - /* Parse args and update the substitution info */ while (argc1) { int n ; @@ -59,6 +57,5 @@ int main (int argc, char const **argv, char const *const *envp) argv += n ; argc1 -= n ; argc -= n ; } - /* Perform the substitution and exec */ el_substandrun(argc-1, argv+1, envp, &info) ; } |