aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--NEWS11
-rwxr-xr-xconfigure13
-rw-r--r--doc/cd.html60
-rw-r--r--doc/execline-cd.html55
-rw-r--r--doc/execline-umask.html51
-rw-r--r--doc/index.html10
-rw-r--r--doc/loopwhilex.html10
-rw-r--r--doc/posix-cd.html66
-rw-r--r--doc/posix-umask.html74
-rw-r--r--doc/umask.html61
-rw-r--r--doc/upgrade.html10
-rw-r--r--package/configure-snippets/configure_case_lines2
-rw-r--r--package/configure-snippets/configure_generate_configh4
-rw-r--r--package/configure-snippets/configure_generate_make5
-rw-r--r--package/configure-snippets/configure_help_options1
-rw-r--r--package/configure-snippets/configure_init_vars1
-rw-r--r--package/deps.mak19
-rw-r--r--package/info2
-rw-r--r--package/modes6
-rw-r--r--package/targets.mak11
-rw-r--r--src/execline/cd.c (renamed from src/execline/execline-cd.c)2
-rw-r--r--src/execline/deps-exe/cd (renamed from src/execline/deps-exe/execline-cd)0
-rw-r--r--src/execline/deps-exe/posix-cd1
-rw-r--r--src/execline/deps-exe/posix-umask1
-rw-r--r--src/execline/deps-exe/umask (renamed from src/execline/deps-exe/execline-umask)0
-rw-r--r--src/execline/emptyenv.c36
-rw-r--r--src/execline/execline-umask.c19
-rw-r--r--src/execline/loopwhilex.c102
-rw-r--r--src/execline/posix-cd.c160
-rw-r--r--src/execline/redirfd.c94
-rw-r--r--src/execline/umask.c (renamed from src/execline/posix-umask.c)58
-rw-r--r--src/execline/umask.txt (renamed from src/execline/posix-umask.txt)0
-rw-r--r--src/execline/wait.c45
-rwxr-xr-xtools/gen-multicall.sh20
35 files changed, 333 insertions, 682 deletions
diff --git a/.gitignore b/.gitignore
index 5118c05..dff0c8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
/background
/backtick
/case
+/cd
/define
/dollarat
/elgetopt
@@ -20,8 +21,6 @@
/envfile
/exec
/execlineb
-/execline-cd
-/execline-umask
/exit
/export
/export-array
@@ -49,8 +48,6 @@
/multisubstitute
/pipeline
/piperw
-/posix-cd
-/posix-umask
/redirfd
/runblock
/shift
diff --git a/NEWS b/NEWS
index a42f9a7..a69510f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,16 @@
Changelog for execline.
+In 2.10.0.0
+-----------
+
+ - --enable-pedantic-posix option removed.
+ - execline-cd is now cd.
+ - posix-umask is now umask.
+ - execline-umask and posix-cd removed.
+ - loopwhilex -n option removed.
+ - loopwhilex -x "" now loops forever.
+
+
In 2.9.9.2
----------
diff --git a/configure b/configure
index 323ce07..d6ed5c4 100755
--- a/configure
+++ b/configure
@@ -51,7 +51,6 @@ Optional features:
--enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled]
--enable-absolute-paths hardcode absolute BINDIR/foobar paths in binaries [disabled]
--enable-nsss use the nsss library for user information [disabled]
- --enable-pedantic-posix use pedantically POSIX-compatible binaries [disabled]
--enable-multicall build a multicall binary [disabled]
EOF
@@ -176,7 +175,6 @@ vpathd=''
build=
shebangisdefault=true
usensss=false
-pposix=false
multicall=false
for arg ; do
@@ -220,8 +218,6 @@ for arg ; do
--shebangdir=*) shebangisdefault=false ; shebangdir=${arg#*=} ;;
--enable-nsss|--enable-nsss=yes) usensss=true ;;
--disable-nsss|--enable-nsss=no) usensss=false ;;
- --enable-pedantic-posix|--enable-pedantic-posix=yes) pposix=true ;;
- --disable-pedantic-posix|--enable-pedantic-posix=no) pposix=false ;;
--enable-multicall|--enable-multicall=yes) multicall=true ;;
--disable-multicall|--enable-multicall=no) multicall=false ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
@@ -543,11 +539,6 @@ else
echo "LIBNSSS :="
echo "MAYBEPTHREAD_LIB :="
fi
-if $pposix ; then
- echo "PEDANTIC_POSIX := 1"
-else
- echo "PEDANTIC_POSIX :="
-fi
if $multicall ; then
echo "MULTICALL := 1"
else
@@ -586,10 +577,6 @@ echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\""
echo "#define ${package_macro_name}_SYSCONFPREFIX \"$sysconfdir/\""
echo "#define ${package_macro_name}_SHEBANGPREFIX \"$shebangdir/\""
echo
-echo "#undef ${package_macro_name}_PEDANTIC_POSIX"
-if $pposix ; then
-echo "#define ${package_macro_name}_PEDANTIC_POSIX"
-fi
echo
echo "#endif"
exec 1>&3 3>&-
diff --git a/doc/cd.html b/doc/cd.html
new file mode 100644
index 0000000..fbd6687
--- /dev/null
+++ b/doc/cd.html
@@ -0,0 +1,60 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="color-scheme" content="dark light" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>execline: the cd command</title>
+ <meta name="Description" content="execline: the cd command" />
+ <meta name="Keywords" content="execline command cd chdir cd" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+</head>
+<body>
+
+<p>
+<a href="index.html">execline</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>cd</tt> program </h1>
+
+<p>
+<tt>cd</tt> changes the current working directory to a
+given directory, then executes a program.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ cd <em>dir</em> <em>prog...</em>
+</pre>
+
+<p>
+<tt>cd</tt> performs a
+<a href="https://pubs.opengroup.org/onlinepubs/9799919799/functions/chdir.html">chdir()</a>
+system call on <em>dir</em>, then execs into <em>prog...</em>.
+</p>
+
+<h2> Notes </h2>
+
+<ul>
+ <li> This <tt>cd</tt> program will never be invoked by a shell, unless its full path
+is explicitly given to the shell command line. So it is perfectly acceptable and valid
+to have a <tt>cd</tt> binary in the filesystem. No confusion will be possible: shells
+will invoke their builtin
+<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html">cd</a>
+utility, and execline scripts will invoke the <tt>cd</tt> binary. </li>
+ <li> Previous versions of POSIX also required a conformant <tt>cd</tt> binary to exist
+in the filesystem, for no reason at all. So, in previous execline versions,
+a <tt>posix-cd</tt> binary was present, and <tt>cd</tt> could be installed as a symlink
+to it when execline was configured with the <tt>--enable-pedantic-posix</tt> option.
+This allowed distributions to make execline binaries, including <tt>cd</tt>, available
+in PATH, while strictly conforming to POSIX. This requirement has now been relaxed by
+POSIX, so the needlessly complex <tt>posix-cd</tt> program was replaced with this
+simpler <tt>cd</tt>, that can now be made available in PATH without breaking strict
+conformance. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/execline-cd.html b/doc/execline-cd.html
deleted file mode 100644
index 6d55142..0000000
--- a/doc/execline-cd.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="color-scheme" content="dark light" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Language" content="en" />
- <title>execline: the execline-cd command</title>
- <meta name="Description" content="execline: the execline-cd command" />
- <meta name="Keywords" content="execline command cd chdir execline-cd" />
- <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
-</head>
-<body>
-
-<p>
-<a href="index.html">execline</a><br />
-<a href="//skarnet.org/software/">Software</a><br />
-<a href="//skarnet.org/">skarnet.org</a>
-</p>
-
-<h1> The <tt>execline-cd</tt> program </h1>
-
-<p>
-<tt>execline-cd</tt> changes the current working directory to a
-given directory, then executes a program.
-</p>
-
-<h2> Interface </h2>
-
-<pre>
- execline-cd <em>dir</em> <em>prog...</em>
-</pre>
-
-<p>
-<tt>execline-cd</tt> performs a
-<a href="https://pubs.opengroup.org/onlinepubs/9799919799/functions/chdir.html">chdir()</a>
-system call on <em>dir</em>, then execs into <em>prog...</em>.
-</p>
-
-<h2> Notes </h2>
-
-<ul>
- <li> By default, <tt>execline-cd</tt> can also be invoked as <tt>cd</tt>:
-there is a <tt>cd</tt> program which is a symbolic link to <tt>execline-cd</tt>. </li>
- <li> When execline has been configured with the <tt>--enable-pedantic-posix</tt>
-option, the <tt>cd</tt> binary is a symbolic link to the
-<a href="posix-cd.html">posix-cd</a> binary instead, so a <tt>cd</tt> command
-in an execline script will invoke <a href="posix-cd.html">posix-cd</a> instead
-of <tt>execline-cd</tt>. </li>
- <li> Existing scripts that call <tt>cd</tt> will keep working no matter the
-chosen configuration. </li>
-</ul>
-
-
-</body>
-</html>
diff --git a/doc/execline-umask.html b/doc/execline-umask.html
deleted file mode 100644
index e0aa76f..0000000
--- a/doc/execline-umask.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="color-scheme" content="dark light" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Language" content="en" />
- <title>execline: the execline-umask command</title>
- <meta name="Description" content="execline: the execline-umask command" />
- <meta name="Keywords" content="execline command umask execline-umask" />
- <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
- </head>
-<body>
-
-<p>
-<a href="index.html">execline</a><br />
-<a href="//skarnet.org/software/">Software</a><br />
-<a href="//skarnet.org/">skarnet.org</a>
-</p>
-
-<h1> The <tt>execline-umask</tt> program </h1>
-
-<p>
-<tt>execline-umask</tt> sets the umask (file creation mask),
-then executes a program.
-</p>
-
-<h2> Interface </h2>
-
-<pre>
- execline-umask <em>mask</em> <em>prog...</em>
-</pre>
-
-<p>
-<tt>execline-umask</tt> sets the current umask to <em>mask</em>,
-then execs into <em>prog...</em>.
-</p>
-
-<h2> Notes </h2>
-
-<ul>
-<li> By default, at execline installation time, a <tt>umask</tt>
-symbolic link is created, pointing to <tt>execline-umask</tt>.
- <li> When execline has been configured with the <tt>--enable-pedantic-posix</tt>
-option, the <tt>umask</tt> symbolic link points to the
-<a href="posix-umask.html">posix-umask</a> binary instead. </li>
- <li> Existing execline scripts calling <tt>umask</tt> will keep working
-no matter the chosen configuration. </li>
-</ul>
-
-</body>
-</html>
diff --git a/doc/index.html b/doc/index.html
index e57e4af..075fcf9 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -78,8 +78,8 @@ want nsswitch-like functionality:
<h3> Download </h3>
<ul>
- <li> The current released version of execline is <a href="execline-2.9.9.2.tar.gz">2.9.9.2</a>.
-You can access its checksum <a href="execline-2.9.9.2.tar.gz.sha256">here</a>. </li>
+ <li> The current released version of execline is <a href="execline-2.10.0.0.tar.gz">2.10.0.0</a>.
+You can access its checksum <a href="execline-2.10.0.0.tar.gz.sha256">here</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgit/execline/">execline
git repository</a>:
@@ -128,10 +128,8 @@ the previous versions of execline and the current one. </li>
(Process state control)
</p>
<ul>
-<li><a href="execline-cd.html">The <tt>execline-cd</tt> program</a></li>
-<li><a href="posix-cd.html">The <tt>posix-cd</tt> program</a></li>
-<li><a href="execline-umask.html">The <tt>execline-umask</tt> program</a></li>
-<li><a href="posix-umask.html">The <tt>posix-umask</tt> program</a></li>
+<li><a href="cd.html">The <tt>cd</tt> program</a></li>
+<li><a href="umask.html">The <tt>umask</tt> program</a></li>
<li><a href="emptyenv.html">The <tt>emptyenv</tt> program</a></li>
<li><a href="envfile.html">The <tt>envfile</tt> program</a></li>
<li><a href="export.html">The <tt>export</tt> program</a></li>
diff --git a/doc/loopwhilex.html b/doc/loopwhilex.html
index 3fd6f08..860c4d8 100644
--- a/doc/loopwhilex.html
+++ b/doc/loopwhilex.html
@@ -26,7 +26,7 @@
<h2> Interface </h2>
<pre>
- loopwhilex [ -n ] [ -o <em>okcodes</em> | -x <em>breakcodes</em> ] <em>prog...</em>
+ loopwhilex [ -o <em>okcodes</em> | -x <em>breakcodes</em> ] <em>prog...</em>
</pre>
<ul>
@@ -48,9 +48,11 @@ looping as long as <em>prog</em> exits with one of the codes in
<li> <tt>-x</tt>&nbsp;<em>breakcodes</em>&nbsp;: like the previous
option, but with inverted meaning - the listed exit codes are codes
that will break the loop and exit, and the unlisted exit codes will keep
-the loop running. </li>
- <li> <tt>-n</tt>&nbsp;: negate the test. This option is now redundant,
-and may disappear soon. </li>
+the loop running. <tt>-x ""</tt> will make <tt>loopwhilex</tt> loop
+forever. </li>
+ <li> If both <tt>-o</tt> and <tt>-x</tt> options are given <tt>-o</tt>
+has priority and the list given by <tt>-x</tt> is ignored. If none of
+these options is given, <tt>-o 0</tt> is the default. </li>
</ul>
<h2> Notes </h2>
diff --git a/doc/posix-cd.html b/doc/posix-cd.html
deleted file mode 100644
index 6419d0a..0000000
--- a/doc/posix-cd.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="color-scheme" content="dark light" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Language" content="en" />
- <title>execline: the posix-cd command</title>
- <meta name="Description" content="execline: the posix-cd command" />
- <meta name="Keywords" content="execline command cd chdir posix posix-cd" />
- <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
-</head>
-<body>
-
-<p>
-<a href="index.html">execline</a><br />
-<a href="//skarnet.org/software/">Software</a><br />
-<a href="//skarnet.org/">skarnet.org</a>
-</p>
-
-<h1> The <tt>posix-cd</tt> program </h1>
-
-<p>
-<tt>posix-cd</tt> changes the current working directory to a
-given directory, then executes a program.
-</p>
-
-<h2> Interface </h2>
-
-<pre>
- posix-cd [ -L | -P ] <em>dir</em> <em>prog...</em>
-</pre>
-
-<p>
-<tt>posix-cd</tt> changes the current working directory to <em>dir</em>
-according to the
-<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html">POSIX
-specification for a <tt>cd</tt> external utility</a>. Then, if <em>prog...</em> is
-not empty, it execs into it.
-</p>
-
-<h2> Notes </h2>
-
-<ul>
- <li> When execline has been configured
-with the <tt>--enable-pedantic-posix</tt> option, the <tt>cd</tt>
-command is a symbolic link to it. So scripts calling <tt>cd</tt>
-will use <tt>posix-cd</tt>. When this configuration option has not
-been given, <tt>cd</tt> is a symbolic link to
-<a href="execline-cd.html">execline-cd</a>. </li>
- <li> <tt>posix-cd</tt> fully conforms to the
-<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html">POSIX
-specification</a>. When <em>prog...</em> is not empty, the behaviour of a
-<tt>cd</tt> utility is not specified by POSIX, so <tt>posix-cd</tt> extends
-the spec to be actually useful and usable in an execline program with the same
-interface as the regular execline <a href="execline-cd.html">cd</a> command. </li>
- <li> Nobody ever executes or needs the external version (i.e. not a shell
-builtin) of the POSIX <tt>cd</tt> command. Compared to execline's regular <tt>cd</tt>
-binary, <a href="execline-cd.html">execline-cd</a>, <tt>posix-cd</tt> is
-uselessly bloated and slow. The only reason it exists is that some
-distributions refuse to package execline correctly unless it is strictly
-POSIX-compliant; the <tt>--enable-pedantic-posix</tt> configure option is
-there to satisfy their requirements. </li>
-</ul>
-
-</body>
-</html>
diff --git a/doc/posix-umask.html b/doc/posix-umask.html
deleted file mode 100644
index f3ab05f..0000000
--- a/doc/posix-umask.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="color-scheme" content="dark light" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Language" content="en" />
- <title>execline: the posix-umask command</title>
- <meta name="Description" content="execline: the posix-umask command" />
- <meta name="Keywords" content="execline command umask mask posix posix-umask" />
- <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
-</head>
-<body>
-
-<p>
-<a href="index.html">execline</a><br />
-<a href="//skarnet.org/software/">Software</a><br />
-<a href="//skarnet.org/">skarnet.org</a>
-</p>
-
-<h1> The <tt>posix-umask</tt> program </h1>
-
-<p>
-<tt>posix-umask</tt> changes its file mode creation mask, then executes a program.
-</p>
-
-<h2> Interface </h2>
-
-<pre>
- posix-umask [ -S ] [ <em>mask</em> ] [ <em>prog...</em> ]
-</pre>
-
-<p>
-When called with no argument, <tt>posix-umask</tt> prints the value of the
-file mode creation mask of the invoking process, then exits 0.
-</p>
-
-<p>
- When called with a <em>mask</em> argument, <tt>posix-umask</tt> changes
-its file mode creation mask; then, if <em>prog...</em> is not empty, it execs
-into it.
-</p>
-
-<p>
- <tt>posix-umask</tt> interprets <em>mask</em> as specified by the
-<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/umask.html">POSIX
-specification for a <tt>umask</tt> external utility</a>.
-</p>
-
-<h2> Notes </h2>
-
-<ul>
- <li> When execline has been configured
-with the <tt>--enable-pedantic-posix</tt> option, the <tt>umask</tt>
-command is a symbolic link to it. So scripts calling <tt>umask</tt>
-will use <tt>posix-umask</tt>. When this configuration option has not
-been given, <tt>umask</tt> is a symbolic link to
-<a href="execline-umask.html">execline-umask</a>. </li>
- <li> <tt>posix-umask</tt> fully conforms to the
-<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/umask.html">POSIX
-specification</a>. When <em>prog...</em> is not empty, the behaviour of a
-<tt>umask</tt> utility is not specified by POSIX, so <tt>posix-umask</tt> extends
-the spec to be actually useful and usable in an execline program with the same
-interface as the regular execline <a href="execline-umask.html">umask</a> command. </li>
- <li> Nobody ever executes or needs the external version (i.e. not a shell
-builtin) of the POSIX <tt>umask</tt> command. Compared to execline's regular <tt>umask</tt>
-binary, <a href="execline-umask.html">execline-umask</a>, <tt>posix-umask</tt> is
-uselessly bloated and slow. The only reason it exists is that some
-distributions refuse to package execline correctly unless it is strictly
-POSIX-compliant; the <tt>--enable-pedantic-posix</tt> configure option is
-there to satisfy their requirements. </li>
-</ul>
-
-</body>
-</html>
diff --git a/doc/umask.html b/doc/umask.html
new file mode 100644
index 0000000..d837130
--- /dev/null
+++ b/doc/umask.html
@@ -0,0 +1,61 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="color-scheme" content="dark light" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>execline: the umask command</title>
+ <meta name="Description" content="execline: the umask command" />
+ <meta name="Keywords" content="execline command umask mask" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+</head>
+<body>
+
+<p>
+<a href="index.html">execline</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>umask</tt> program </h1>
+
+<p>
+<tt>umask</tt> changes its file mode creation mask, then executes a program.
+Alternatively, it can print the current mask.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ umask [ -S ] [ <em>mask</em> ] [ <em>prog...</em> ]
+</pre>
+
+<p>
+When called with no argument, <tt>umask</tt> prints the value of the
+file mode creation mask of the invoking process, then exits 0.
+</p>
+
+<p>
+ When called with a <em>mask</em> argument, <tt>umask</tt> changes
+its file mode creation mask; then, if <em>prog...</em> is not empty, it execs
+into it.
+</p>
+
+<p>
+ <tt>umask</tt> interprets <em>mask</em> as specified by the
+<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/umask.html">POSIX
+specification for a <tt>umask</tt> external utility</a>.
+</p>
+
+<h2> Notes </h2>
+
+<ul>
+ <li> <tt>umask</tt> fully conforms to the
+<a href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/umask.html">POSIX
+specification</a>. When <em>prog...</em> is not empty, the behaviour of a
+<tt>umask</tt> utility is not specified by POSIX, so <tt>umask</tt> extends
+the spec to be actually useful and usable in an execline program. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index e814afa..31de4b9 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -19,6 +19,16 @@
<h1> What has changed in execline </h1>
+<h2> in 2.10.0.0 </h2>
+
+<ul>
+ <li> The <tt>--enable-pedantic-posix</tt> configuration option has
+been removed, due to POSIX relaxing requirements on intrinsic utilities. </li>
+ <li> The <a href="cd.html">cd</a> binary is now what was previously <tt>execline-cd</tt>. </li>
+ <li> The <a href="umask.html">umask</a> binary is now what was previously <tt>posix-umask</tt>,
+(without locale support, not that it had much to start with) </li>
+</ul>
+
<h2> in 2.9.9.2 </h2>
<ul>
diff --git a/package/configure-snippets/configure_case_lines b/package/configure-snippets/configure_case_lines
index e193af8..30bde83 100644
--- a/package/configure-snippets/configure_case_lines
+++ b/package/configure-snippets/configure_case_lines
@@ -1,7 +1,5 @@
--shebangdir=*) shebangisdefault=false ; shebangdir=${arg#*=} ;;
--enable-nsss|--enable-nsss=yes) usensss=true ;;
--disable-nsss|--enable-nsss=no) usensss=false ;;
- --enable-pedantic-posix|--enable-pedantic-posix=yes) pposix=true ;;
- --disable-pedantic-posix|--enable-pedantic-posix=no) pposix=false ;;
--enable-multicall|--enable-multicall=yes) multicall=true ;;
--disable-multicall|--enable-multicall=no) multicall=false ;;
diff --git a/package/configure-snippets/configure_generate_configh b/package/configure-snippets/configure_generate_configh
index ef276bd..cd338aa 100644
--- a/package/configure-snippets/configure_generate_configh
+++ b/package/configure-snippets/configure_generate_configh
@@ -1,6 +1,2 @@
echo "#define ${package_macro_name}_SHEBANGPREFIX \"$shebangdir/\""
echo
-echo "#undef ${package_macro_name}_PEDANTIC_POSIX"
-if $pposix ; then
-echo "#define ${package_macro_name}_PEDANTIC_POSIX"
-fi
diff --git a/package/configure-snippets/configure_generate_make b/package/configure-snippets/configure_generate_make
index dbf93ff..3590ea5 100644
--- a/package/configure-snippets/configure_generate_make
+++ b/package/configure-snippets/configure_generate_make
@@ -5,11 +5,6 @@ else
echo "LIBNSSS :="
echo "MAYBEPTHREAD_LIB :="
fi
-if $pposix ; then
- echo "PEDANTIC_POSIX := 1"
-else
- echo "PEDANTIC_POSIX :="
-fi
if $multicall ; then
echo "MULTICALL := 1"
else
diff --git a/package/configure-snippets/configure_help_options b/package/configure-snippets/configure_help_options
index c6fd410..0874fae 100644
--- a/package/configure-snippets/configure_help_options
+++ b/package/configure-snippets/configure_help_options
@@ -1,4 +1,3 @@
--enable-nsss use the nsss library for user information [disabled]
- --enable-pedantic-posix use pedantically POSIX-compatible binaries [disabled]
--enable-multicall build a multicall binary [disabled]
diff --git a/package/configure-snippets/configure_init_vars b/package/configure-snippets/configure_init_vars
index 91a8590..ad92eac 100644
--- a/package/configure-snippets/configure_init_vars
+++ b/package/configure-snippets/configure_init_vars
@@ -1,4 +1,3 @@
shebangisdefault=true
usensss=false
-pposix=false
multicall=false
diff --git a/package/deps.mak b/package/deps.mak
index 44338fd..94192c2 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -5,6 +5,7 @@
src/execline/background.o src/execline/background.lo: src/execline/background.c src/include/execline/execline.h
src/execline/backtick.o src/execline/backtick.lo: src/execline/backtick.c src/include/execline/execline.h
src/execline/case.o src/execline/case.lo: src/execline/case.c src/include/execline/execline.h
+src/execline/cd.o src/execline/cd.lo: src/execline/cd.c
src/execline/define.o src/execline/define.lo: src/execline/define.c src/include-local/exlsn.h
src/execline/dollarat.o src/execline/dollarat.lo: src/execline/dollarat.c
src/execline/elgetopt.o src/execline/elgetopt.lo: src/execline/elgetopt.c src/include/execline/execline.h
@@ -14,8 +15,6 @@ src/execline/eltest.o src/execline/eltest.lo: src/execline/eltest.c
src/execline/emptyenv.o src/execline/emptyenv.lo: src/execline/emptyenv.c src/include/execline/execline.h
src/execline/envfile.o src/execline/envfile.lo: src/execline/envfile.c
src/execline/exec.o src/execline/exec.lo: src/execline/exec.c
-src/execline/execline-cd.o src/execline/execline-cd.lo: src/execline/execline-cd.c
-src/execline/execline-umask.o src/execline/execline-umask.lo: src/execline/execline-umask.c
src/execline/execlineb.o src/execline/execlineb.lo: src/execline/execlineb.c src/include/execline/execline.h src/include-local/exlsn.h
src/execline/exit.o src/execline/exit.lo: src/execline/exit.c
src/execline/export-array.o src/execline/export-array.lo: src/execline/export-array.c src/include/execline/execline.h
@@ -43,13 +42,12 @@ src/execline/multidefine.o src/execline/multidefine.lo: src/execline/multidefine
src/execline/multisubstitute.o src/execline/multisubstitute.lo: src/execline/multisubstitute.c src/include/execline/execline.h src/include-local/exlsn.h
src/execline/pipeline.o src/execline/pipeline.lo: src/execline/pipeline.c src/include/execline/execline.h
src/execline/piperw.o src/execline/piperw.lo: src/execline/piperw.c
-src/execline/posix-cd.o src/execline/posix-cd.lo: src/execline/posix-cd.c
-src/execline/posix-umask.o src/execline/posix-umask.lo: src/execline/posix-umask.c
src/execline/redirfd.o src/execline/redirfd.lo: src/execline/redirfd.c src/include/execline/execline.h
src/execline/runblock.o src/execline/runblock.lo: src/execline/runblock.c src/include/execline/execline.h
src/execline/shift.o src/execline/shift.lo: src/execline/shift.c src/include/execline/execline.h
src/execline/trap.o src/execline/trap.lo: src/execline/trap.c src/include/execline/execline.h
src/execline/tryexec.o src/execline/tryexec.lo: src/execline/tryexec.c src/include/execline/execline.h
+src/execline/umask.o src/execline/umask.lo: src/execline/umask.c
src/execline/unexport.o src/execline/unexport.lo: src/execline/unexport.c
src/execline/wait.o src/execline/wait.lo: src/execline/wait.c src/include/execline/config.h src/include/execline/execline.h
src/execline/withstdinas.o src/execline/withstdinas.lo: src/execline/withstdinas.c src/include/execline/execline.h
@@ -82,6 +80,7 @@ src/libexecline/exlsn_free.o src/libexecline/exlsn_free.lo: src/libexecline/exls
src/libexecline/exlsn_importas.o src/libexecline/exlsn_importas.lo: src/libexecline/exlsn_importas.c src/include/execline/execline.h src/include-local/exlsn.h
src/libexecline/exlsn_main.o src/libexecline/exlsn_main.lo: src/libexecline/exlsn_main.c src/include/execline/execline.h src/include-local/exlsn.h
src/libexecline/exlsn_multidefine.o src/libexecline/exlsn_multidefine.lo: src/libexecline/exlsn_multidefine.c src/include/execline/execline.h src/include-local/exlsn.h
+src/multicall/execline.o src/multicall/execline.lo: src/multicall/execline.c src/include/execline/config.h src/include/execline/execline.h src/include-local/exlsn.h
background: EXTRA_LIBS := ${SPAWN_LIB}
background: src/execline/background.o ${LIBEXECLINE} -lskarnet
@@ -89,6 +88,8 @@ backtick: EXTRA_LIBS := ${SPAWN_LIB}
backtick: src/execline/backtick.o ${LIBEXECLINE} -lskarnet
case: EXTRA_LIBS :=
case: src/execline/case.o ${LIBEXECLINE} -lskarnet
+cd: EXTRA_LIBS :=
+cd: src/execline/cd.o -lskarnet
define: EXTRA_LIBS :=
define: src/execline/define.o ${LIBEXECLINE} -lskarnet
dollarat: EXTRA_LIBS :=
@@ -107,10 +108,6 @@ envfile: EXTRA_LIBS :=
envfile: src/execline/envfile.o -lskarnet
exec: EXTRA_LIBS :=
exec: src/execline/exec.o -lskarnet
-execline-cd: EXTRA_LIBS :=
-execline-cd: src/execline/execline-cd.o -lskarnet
-execline-umask: EXTRA_LIBS :=
-execline-umask: src/execline/execline-umask.o -lskarnet
execlineb: EXTRA_LIBS :=
execlineb: src/execline/execlineb.o ${LIBEXECLINE} -lskarnet
exit: EXTRA_LIBS :=
@@ -165,10 +162,6 @@ pipeline: EXTRA_LIBS := ${SPAWN_LIB}
pipeline: src/execline/pipeline.o ${LIBEXECLINE} -lskarnet
piperw: EXTRA_LIBS :=
piperw: src/execline/piperw.o -lskarnet
-posix-cd: EXTRA_LIBS :=
-posix-cd: src/execline/posix-cd.o -lskarnet
-posix-umask: EXTRA_LIBS :=
-posix-umask: src/execline/posix-umask.o -lskarnet
redirfd: EXTRA_LIBS :=
redirfd: src/execline/redirfd.o ${LIBEXECLINE} -lskarnet
runblock: EXTRA_LIBS :=
@@ -179,6 +172,8 @@ trap: EXTRA_LIBS := ${SPAWN_LIB}
trap: src/execline/trap.o ${LIBEXECLINE} -lskarnet
tryexec: EXTRA_LIBS :=
tryexec: src/execline/tryexec.o ${LIBEXECLINE} -lskarnet
+umask: EXTRA_LIBS :=
+umask: src/execline/umask.o -lskarnet
unexport: EXTRA_LIBS :=
unexport: src/execline/unexport.o -lskarnet
wait: EXTRA_LIBS :=
diff --git a/package/info b/package/info
index 518ffa8..76d9d2c 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=execline
-version=2.9.9.2
+version=2.10.0.0
category=admin
package_macro_name=EXECLINE
diff --git a/package/modes b/package/modes
index b07e67a..025602e 100644
--- a/package/modes
+++ b/package/modes
@@ -1,14 +1,13 @@
background 0755
backtick 0755
case 0755
+cd 0755
define 0755
dollarat 0755
elgetopt 0755
elgetpositionals 0755
elglob 0755
eltest 0755
-execline-cd 0755
-execline-umask 0755
emptyenv 0755
envfile 0755
exec 0755
@@ -39,13 +38,12 @@ multidefine 0755
multisubstitute 0755
piperw 0755
pipeline 0755
-posix-cd 0755
-posix-umask 0755
redirfd 0755
runblock 0755
shift 0755
trap 0755
tryexec 0755
+umask 0755
unexport 0755
wait 0755
withstdinas 0755
diff --git a/package/targets.mak b/package/targets.mak
index 8fc04a1..a255280 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -6,7 +6,7 @@ ifeq ($(MULTICALL),1)
BIN_TARGETS := execline
CONTENTS := $(notdir $(wildcard src/execline/deps-exe/*))
-BIN_SYMLINKS := cd umask $(CONTENTS)
+BIN_SYMLINKS := $(CONTENTS)
EXTRA_TARGETS += src/multicall/execline.c
define symlink_definition
@@ -22,14 +22,5 @@ src/multicall/execline.o: src/multicall/execline.c src/include/execline/config.h
else
BIN_TARGETS := $(notdir $(wildcard src/execline/deps-exe/*))
-BIN_SYMLINKS := cd umask
-
-ifeq ($(PEDANTIC_POSIX),1)
-SYMLINK_TARGET_cd := posix-cd
-SYMLINK_TARGET_umask := posix-umask
-else
-SYMLINK_TARGET_cd := execline-cd
-SYMLINK_TARGET_umask := execline-umask
-endif
endif
diff --git a/src/execline/execline-cd.c b/src/execline/cd.c
index 1762708..734c375 100644
--- a/src/execline/execline-cd.c
+++ b/src/execline/cd.c
@@ -9,7 +9,7 @@
int main (int argc, char const *const *argv)
{
- PROG = "execline-cd" ;
+ PROG = "cd" ;
if (argc < 3) strerr_dieusage(100, USAGE) ;
if (chdir(argv[1]) == -1)
strerr_diefu2sys(111, "chdir to ", argv[1]) ;
diff --git a/src/execline/deps-exe/execline-cd b/src/execline/deps-exe/cd
index e7187fe..e7187fe 100644
--- a/src/execline/deps-exe/execline-cd
+++ b/src/execline/deps-exe/cd
diff --git a/src/execline/deps-exe/posix-cd b/src/execline/deps-exe/posix-cd
deleted file mode 100644
index e7187fe..0000000
--- a/src/execline/deps-exe/posix-cd
+++ /dev/null
@@ -1 +0,0 @@
--lskarnet
diff --git a/src/execline/deps-exe/posix-umask b/src/execline/deps-exe/posix-umask
deleted file mode 100644
index e7187fe..0000000
--- a/src/execline/deps-exe/posix-umask
+++ /dev/null
@@ -1 +0,0 @@
--lskarnet
diff --git a/src/execline/deps-exe/execline-umask b/src/execline/deps-exe/umask
index e7187fe..e7187fe 100644
--- a/src/execline/deps-exe/execline-umask
+++ b/src/execline/deps-exe/umask
diff --git a/src/execline/emptyenv.c b/src/execline/emptyenv.c
index ac59697..ed1a893 100644
--- a/src/execline/emptyenv.c
+++ b/src/execline/emptyenv.c
@@ -19,22 +19,22 @@
enum emptyenv_golb_e
{
- GOLB_PATH = 0x01,
- GOLB_LIB = 0x02,
- GOLB_CLEANUP = 0x04,
- GOLB_OPT = 0x08,
- GOLB_POS = 0x10
+ EMPTYENV_GOLB_PATH = 0x01,
+ EMPTYENV_GOLB_LIB = 0x02,
+ EMPTYENV_GOLB_CLEANUP = 0x04,
+ EMPTYENV_GOLB_OPT = 0x08,
+ EMPTYENV_GOLB_POS = 0x10
} ;
int main (int argc, char const *const *argv)
{
static gol_bool const rgolb[5] =
{
- { .so = 'p', .lo = "keep-path", .clear = 0, .set = GOLB_PATH },
- { .so = 'l', .lo = "keep-ld-library-path", .clear = 0, .set = GOLB_LIB },
- { .so = 'c', .lo = "cleanup", .clear = 0, .set = GOLB_CLEANUP },
- { .so = 'o', .lo = "pop-elgetopt", .clear = 0, .set = GOLB_OPT },
- { .so = 'P', .lo = "pop-execline", .clear = 0, .set = GOLB_POS }
+ { .so = 'p', .lo = "keep-path", .clear = 0, .set = EMPTYENV_GOLB_PATH },
+ { .so = 'l', .lo = "keep-ld-library-path", .clear = 0, .set = EMPTYENV_GOLB_LIB },
+ { .so = 'c', .lo = "cleanup", .clear = 0, .set = EMPTYENV_GOLB_CLEANUP },
+ { .so = 'o', .lo = "pop-elgetopt", .clear = 0, .set = EMPTYENV_GOLB_OPT },
+ { .so = 'P', .lo = "pop-execline", .clear = 0, .set = EMPTYENV_GOLB_POS }
} ;
uint64_t wgolb = 0 ;
unsigned int golc ;
@@ -43,7 +43,7 @@ int main (int argc, char const *const *argv)
argc -= golc ; argv += golc ;
if (!argc) strerr_dieusage(100, USAGE) ;
- if (wgolb & GOLB_CLEANUP)
+ if (wgolb & EMPTYENV_GOLB_CLEANUP)
{
static char const *const onebyte = "!?#0" ;
char *const *envp = environ ;
@@ -88,12 +88,12 @@ int main (int argc, char const *const *argv)
strerr_diefu1sys(111, "clean up environment") ;
}
- else if (wgolb & (GOLB_OPT | GOLB_POS))
+ else if (wgolb & (EMPTYENV_GOLB_OPT | EMPTYENV_GOLB_POS))
{
static char const *const list[12] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "ELGETOPT_" } ;
stralloc sa = STRALLOC_ZERO ;
size_t envlen = env_len((char const *const *)environ) ;
- int n = el_popenv(&sa, (char const *const *)environ, envlen, wgolb & GOLB_POS ? list : list + 11, (wgolb & GOLB_POS ? 11 : 0) + !!(wgolb & GOLB_OPT)) ;
+ int n = el_popenv(&sa, (char const *const *)environ, envlen, wgolb & EMPTYENV_GOLB_POS ? list : list + 11, (wgolb & EMPTYENV_GOLB_POS ? 11 : 0) + !!(wgolb & EMPTYENV_GOLB_OPT)) ;
if (n < 0) strerr_diefu1sys(111, "pop current execline environment") ;
{
char const *v[envlen - n + 1] ;
@@ -108,18 +108,18 @@ int main (int argc, char const *const *argv)
char const *newenv[3] = { 0, 0, 0 } ;
char *const *envp = environ ;
unsigned int m = 0 ;
- wgolb &= GOLB_PATH | GOLB_LIB ;
+ wgolb &= EMPTYENV_GOLB_PATH | EMPTYENV_GOLB_LIB ;
for (; wgolb && *envp ; envp++)
{
- if (wgolb & GOLB_PATH && !strncmp(*envp, "PATH=", 5))
+ if (wgolb & EMPTYENV_GOLB_PATH && !strncmp(*envp, "PATH=", 5))
{
newenv[m++] = *envp ;
- wgolb &= ~GOLB_PATH ;
+ wgolb &= ~EMPTYENV_GOLB_PATH ;
}
- if (wgolb & GOLB_LIB && !strncmp(*envp, "LD_LIBRARY_PATH=", 16))
+ if (wgolb & EMPTYENV_GOLB_LIB && !strncmp(*envp, "LD_LIBRARY_PATH=", 16))
{
newenv[m++] = *envp ;
- wgolb &= ~GOLB_LIB ;
+ wgolb &= ~EMPTYENV_GOLB_LIB ;
}
}
xexec_e(argv, newenv) ;
diff --git a/src/execline/execline-umask.c b/src/execline/execline-umask.c
deleted file mode 100644
index c5aacda..0000000
--- a/src/execline/execline-umask.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ISC license. */
-
-#include <sys/stat.h>
-
-#include <skalibs/types.h>
-#include <skalibs/strerr.h>
-#include <skalibs/exec.h>
-
-#define USAGE "umask value prog..."
-
-int main (int argc, char const *const *argv)
-{
- unsigned int m ;
- PROG = "execline-umask" ;
- if (argc < 3) strerr_dieusage(100, USAGE) ;
- if (!uint_oscan(argv[1], &m)) strerr_dieusage(100, USAGE) ;
- umask(m) ;
- xexec(argv+2) ;
-}
diff --git a/src/execline/loopwhilex.c b/src/execline/loopwhilex.c
index acae3b3..fdd05b8 100644
--- a/src/execline/loopwhilex.c
+++ b/src/execline/loopwhilex.c
@@ -1,73 +1,91 @@
/* ISC license. */
+#include <stdint.h>
+#include <stdlib.h>
#include <errno.h>
-#include <skalibs/sgetopt.h>
-#include <skalibs/strerr.h>
+#include <skalibs/gol.h>
+#include <skalibs/uint64.h>
#include <skalibs/types.h>
+#include <skalibs/strerr.h>
#include <skalibs/djbunix.h>
#include <execline/execline.h>
-#define USAGE "loopwhilex [ -n ] [ -o okcode,okcode,... | -x exitcode,exitcode,... ] prog..."
+#define USAGE "loopwhilex [ -o okcode,okcode,... | -x exitcode,exitcode,... ] prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static int lw_isok (unsigned short *tab, unsigned int n, int code)
+enum lw_gola_e
+{
+ LW_GOLA_OK,
+ LW_GOLA_EXCLUDE,
+ LW_GOLA_N
+} ;
+
+static int lw_uint8_cmp (void const *a, void const *b)
+{
+ uint8_t aa = *(uint8_t const *)a ;
+ uint8_t bb = *(uint8_t const *)b ;
+ return aa < bb ? -1 : aa > bb ;
+}
+
+static size_t lw_scanlist (char const *s, uint8_t *tab)
{
- unsigned int i = 0 ;
- for (; i < n ; i++) if ((unsigned short)code == tab[i]) break ;
- return i < n ;
+ size_t n = 0 ;
+ while (*s)
+ {
+ uint64_t u ;
+ size_t l = uint64_scan(s, &u) ;
+ if (!l) break ;
+ if (u > 256 || n >= 255) dieusage() ;
+ tab[n++] = u ;
+ s += l ;
+ while (*s == ',') s++ ;
+ }
+ if (*s) dieusage() ;
+ qsort(tab, n, 1, &lw_uint8_cmp) ;
+ return n ;
}
int main (int argc, char const *const *argv, char const *const *envp)
{
- int wstat ;
- int not = 0, cont = 1, rev = 0 ;
- unsigned short okcodes[256] ;
- size_t nbc = 0 ;
+ static gol_arg const rgola[] =
+ {
+ { .so = 'o', .lo = "ok-codes", .i = LW_GOLA_OK },
+ { .so = 'x', .lo = "exclude-codes", .i = LW_GOLA_EXCLUDE },
+ } ;
+ int rev = 0 ;
+ char const *wgola[LW_GOLA_N] = { 0 } ;
+ size_t n = 0 ;
+ uint8_t codes[256] = { 0 } ;
PROG = "loopwhilex" ;
+
{
- subgetopt l = SUBGETOPT_ZERO ;
- for (;;)
- {
- int opt = subgetopt_r(argc, argv, "no:x:", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'n' : not = 1 ; break ;
- case 'o' :
- rev = 0 ;
- if (!ushort_scanlist(okcodes, 256, l.arg, &nbc)) dieusage() ;
- break ;
- case 'x' :
- rev = 1 ;
- if (!ushort_scanlist(okcodes, 256, l.arg, &nbc)) dieusage() ;
- break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
+ unsigned int golc = gol_main(argc, argv, 0, 0, rgola, sizeof(rgola)/sizeof(gol_arg), 0, wgola) ;
+ argc -= golc ; argv += golc ;
}
if (!argc) dieusage() ;
-
- if (!nbc)
+ if (wgola[LW_GOLA_OK]) n = lw_scanlist(wgola[LW_GOLA_OK], codes) ;
+ else if (wgola[LW_GOLA_EXCLUDE])
{
- okcodes[0] = 0 ;
- nbc = 1 ;
+ n = lw_scanlist(wgola[LW_GOLA_EXCLUDE], codes) ;
+ rev = 1 ;
}
- else if (rev) not = !not ;
+ else n = 1 ;
- while (cont)
+ for (;;)
{
+ int wstat ;
pid_t pid = el_spawn0(argv[0], argv, envp) ;
if (!pid)
{
if (errno == ENOENT && argv[0][0] == ' ')
- strerr_diefu3x(111, "spawn ", argv[0], ": name begins with a space, are you trying to spawn a block as your loop body?") ;
- else strerr_diefu2sys(111, "spawn ", argv[0]) ;
+ strerr_dief(111, "spawn ", argv[0], ": name begins with a space, are you trying to spawn a block as your loop body?") ;
+ else strerr_diefusys(111, "spawn ", argv[0]) ;
}
- if (wait_pid(pid, &wstat) < 0) strerr_diefu1sys(111, "wait_pid") ;
- cont = not != lw_isok(okcodes, nbc, wait_estatus(wstat)) ;
+ if (wait_pid(pid, &wstat) < 0) strerr_diefusys(111, "wait_pid") ;
+ codes[255] = wait_estatus(wstat) ;
+ if (rev != !bsearch(codes + 255, codes, n, 1, &lw_uint8_cmp)) break ;
}
- return wait_estatus(wstat) ;
+ return codes[255] ;
}
diff --git a/src/execline/posix-cd.c b/src/execline/posix-cd.c
deleted file mode 100644
index e9bfd35..0000000
--- a/src/execline/posix-cd.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* ISC license. */
-
-#include <sys/stat.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <locale.h>
-
-#include <skalibs/bytestr.h>
-#include <skalibs/sgetopt.h>
-#include <skalibs/allreadwrite.h>
-#include <skalibs/strerr.h>
-#include <skalibs/stralloc.h>
-#include <skalibs/djbunix.h>
-#include <skalibs/env.h>
-#include <skalibs/exec.h>
-
-#define USAGE "posix-cd [ -L | -P ] [ - | path ] [ prog... ]"
-#define dieusage() strerr_dieusage(100, USAGE)
-#define dienomem() strerr_diefu1sys(111, "stralloc_catb")
-
-int main (int argc, char const **argv)
-{
- int phy = 0 ;
- int dopwd = 0 ;
- char const *where ;
- int got = 0 ;
- stralloc sa = STRALLOC_ZERO ;
- PROG = "posix-cd" ;
- setlocale(LC_ALL, "") ; /* yeah, as if */
-
- {
- subgetopt l = SUBGETOPT_ZERO ;
- for (;;)
- {
- int opt = subgetopt_r(argc, argv, "LP", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'L' : phy = 0 ; break ;
- case 'P' : phy = 1 ; break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
- }
- if (!argc) where = getenv("HOME") ;
- else
- {
- where = *argv++ ;
- if (!strcmp(where, "-"))
- {
- where = getenv("OLDPWD") ;
- dopwd = 1 ;
- }
- }
- if (!where || !where[0]) dieusage() ;
-
- if (!(where[0] == '/' || (where[0] == '.' && (!where[1] || where[1] == '/' || (where[1] == '.' && (!where[2] || where[2] == '/'))))))
- {
- char const *cdpath = getenv("CDPATH") ;
- if (cdpath)
- {
- size_t pos = 0 ;
- size_t len = strlen(cdpath) ;
- while (pos < len)
- {
- struct stat st ;
- size_t m = byte_chr(cdpath + pos, len - pos, ':') ;
- sa.len = 0 ;
- if (m)
- {
- if (!stralloc_catb(&sa, cdpath + pos, m)) dienomem() ;
- if (cdpath[pos + m - 1] != '/' && !stralloc_catb(&sa, "/", 1)) dienomem() ;
- }
- else if (!stralloc_catb(&sa, "./", 2)) dienomem() ;
- if (!stralloc_cats(&sa, where) || !stralloc_0(&sa)) dienomem() ;
- if (!stat(sa.s, &st) && S_ISDIR(st.st_mode))
- {
- got = 1 ;
- dopwd = 1 ;
- break ;
- }
- pos += m+1 ;
- }
- }
- }
-
- if (!got && (!stralloc_cats(&sa, where) || !stralloc_0(&sa))) dienomem() ;
-
- {
- size_t sabase = sa.len ;
- if (sagetcwd(&sa) < 0) strerr_diefu1sys(111, "getcwd") ;
- if (!stralloc_0(&sa)) dienomem() ;
- if (!env_mexec("OLDPWD", sa.s + sabase)) dienomem() ;
- sa.len = sabase ;
- }
-
- if (!phy)
- {
- char const *x = getenv("PWD") ;
- if (x && sa.s[0] != '/')
- {
- size_t len = strlen(x) ;
- int doslash = len && x[len-1] != '/' ;
- if (!stralloc_insertb(&sa, 0, x, len + doslash)) dienomem() ;
- if (doslash) sa.s[len] = '/' ;
- }
- {
- stralloc tmp = STRALLOC_ZERO ;
- if (!stralloc_ready(&tmp, sa.len + 2)) dienomem() ;
- tmp.len = path_canonicalize(tmp.s, sa.s, 1) ;
- if (!tmp.len++)
- strerr_diefu4sys(111, "canonicalize ", sa.s, ": problem with ", tmp.s) ;
- stralloc_free(&sa) ;
- sa = tmp ;
- }
- if (!env_mexec("PWD", sa.s)) dienomem() ;
-#ifdef PATH_MAX
- if (sa.len > PATH_MAX && strlen(where) < PATH_MAX && x && *x)
- {
- size_t len = strlen(x) ;
- int hasslash = x[len-1] == '/' ;
- if (!strncmp(sa.s, x, len))
- {
- if (hasslash || (sa.len > len && sa.s[len] == '/'))
- {
- sa.len -= len + !hasslash ;
- memmove(sa.s, sa.s + len + !hasslash, sa.len) ;
- }
- }
- }
-#endif
- }
-
- /* fking finally */
-
- if (chdir(sa.s) < 0)
- strerr_diefu2sys(111, "chdir to ", where) ;
-
- /* and there's still more nonsense to do afterwards! */
-
- if (phy)
- {
- sa.len = 0 ;
- if (sagetcwd(&sa) < 0) strerr_diefu1sys(111, "getcwd") ;
- if (!stralloc_0(&sa)) dienomem() ;
- if (!env_mexec("PWD", sa.s)) dienomem() ;
- }
-
- if (dopwd)
- {
- sa.s[sa.len - 1] = '\n' ;
- if (allwrite(1, sa.s, sa.len) < sa.len)
- strerr_diefu1sys(111, "write to stdout") ;
- }
-
- xmexec0(argv) ;
-}
diff --git a/src/execline/redirfd.c b/src/execline/redirfd.c
index c3562f9..c9a7f9e 100644
--- a/src/execline/redirfd.c
+++ b/src/execline/redirfd.c
@@ -13,47 +13,47 @@
#define USAGE "redirfd -[ r | w | u | a | x ] [ -N | -n ] [ -b ] [ -f ] [ -E | -e ] fd|var file prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-enum golb_e
+enum redirfd_golb_e
{
- GOLB_READ = 0x0001,
- GOLB_WRITE = 0x0002,
- GOLB_CREAT = 0x0004,
- GOLB_APPEND = 0x0008,
- GOLB_TRUNC = 0x0010,
- GOLB_EXCL = 0x0020,
- GOLB_NONBLOCK = 0x0040,
- GOLB_CHANGEMODE = 0x0100,
- GOLB_OPEN = 0x0200,
- GOLB_AUTOIMPORT = 0x0400,
+ REDIRFD_GOLB_READ = 0x0001,
+ REDIRFD_GOLB_WRITE = 0x0002,
+ REDIRFD_GOLB_CREAT = 0x0004,
+ REDIRFD_GOLB_APPEND = 0x0008,
+ REDIRFD_GOLB_TRUNC = 0x0010,
+ REDIRFD_GOLB_EXCL = 0x0020,
+ REDIRFD_GOLB_NONBLOCK = 0x0040,
+ REDIRFD_GOLB_CHANGEMODE = 0x0100,
+ REDIRFD_GOLB_OPEN = 0x0200,
+ REDIRFD_GOLB_AUTOIMPORT = 0x0400,
} ;
int main (int argc, char const *const *argv)
{
static gol_bool const rgolb[] =
{
- { .so = 'r', .lo = 0, .clear = GOLB_WRITE | GOLB_APPEND | GOLB_CREAT | GOLB_TRUNC | GOLB_EXCL, .set = GOLB_READ },
- { .so = 'w', .lo = 0, .clear = GOLB_READ | GOLB_APPEND | GOLB_EXCL, .set = GOLB_WRITE | GOLB_CREAT | GOLB_TRUNC },
- { .so = 'u', .lo = 0, .clear = GOLB_APPEND | GOLB_CREAT | GOLB_TRUNC | GOLB_EXCL, .set = GOLB_READ | GOLB_WRITE },
- { .so = 'a', .lo = 0, .clear = GOLB_READ | GOLB_TRUNC | GOLB_EXCL, .set = GOLB_WRITE | GOLB_CREAT | GOLB_APPEND },
- { .so = 'x', .lo = 0, .clear = GOLB_READ | GOLB_APPEND | GOLB_TRUNC, .set = GOLB_WRITE | GOLB_CREAT | GOLB_EXCL },
- { .so = 'N', .lo = "block", .clear = GOLB_NONBLOCK, .set = 0 },
- { .so = 'n', .lo = "nonblock", .clear = 0, .set = GOLB_NONBLOCK },
- { .so = 'b', .lo = "switch-block", .clear = 0, .set = GOLB_CHANGEMODE },
- { .so = 'f', .lo = "open", .clear = 0, .set = GOLB_OPEN },
- { .so = 'e', .lo = "no-autoimport", .clear = GOLB_AUTOIMPORT, .set = 0 },
- { .so = 'E', .lo = "autoimport", .clear = 0, .set = GOLB_AUTOIMPORT },
- { .so = 0, .lo = "no-read", .clear = GOLB_READ, .set = 0 },
- { .so = 0, .lo = "read", .clear = 0, .set = GOLB_READ },
- { .so = 0, .lo = "no-write", .clear = GOLB_WRITE, .set = 0 },
- { .so = 0, .lo = "write", .clear = 0, .set = GOLB_WRITE },
- { .so = 0, .lo = "no-create", .clear = GOLB_CREAT, .set = 0 },
- { .so = 0, .lo = "create", .clear = 0, .set = GOLB_CREAT },
- { .so = 0, .lo = "no-append", .clear = GOLB_APPEND, .set = 0 },
- { .so = 0, .lo = "append", .clear = 0, .set = GOLB_APPEND },
- { .so = 0, .lo = "no-trunc", .clear = GOLB_TRUNC, .set = 0 },
- { .so = 0, .lo = "trunc", .clear = 0, .set = GOLB_TRUNC },
- { .so = 0, .lo = "no-excl", .clear = GOLB_EXCL, .set = 0 },
- { .so = 0, .lo = "excl", .clear = 0, .set = GOLB_EXCL },
+ { .so = 'r', .lo = 0, .clear = REDIRFD_GOLB_WRITE | REDIRFD_GOLB_APPEND | REDIRFD_GOLB_CREAT | REDIRFD_GOLB_TRUNC | REDIRFD_GOLB_EXCL, .set = REDIRFD_GOLB_READ },
+ { .so = 'w', .lo = 0, .clear = REDIRFD_GOLB_READ | REDIRFD_GOLB_APPEND | REDIRFD_GOLB_EXCL, .set = REDIRFD_GOLB_WRITE | REDIRFD_GOLB_CREAT | REDIRFD_GOLB_TRUNC },
+ { .so = 'u', .lo = 0, .clear = REDIRFD_GOLB_APPEND | REDIRFD_GOLB_CREAT | REDIRFD_GOLB_TRUNC | REDIRFD_GOLB_EXCL, .set = REDIRFD_GOLB_READ | REDIRFD_GOLB_WRITE },
+ { .so = 'a', .lo = 0, .clear = REDIRFD_GOLB_READ | REDIRFD_GOLB_TRUNC | REDIRFD_GOLB_EXCL, .set = REDIRFD_GOLB_WRITE | REDIRFD_GOLB_CREAT | REDIRFD_GOLB_APPEND },
+ { .so = 'x', .lo = 0, .clear = REDIRFD_GOLB_READ | REDIRFD_GOLB_APPEND | REDIRFD_GOLB_TRUNC, .set = REDIRFD_GOLB_WRITE | REDIRFD_GOLB_CREAT | REDIRFD_GOLB_EXCL },
+ { .so = 'N', .lo = "block", .clear = REDIRFD_GOLB_NONBLOCK, .set = 0 },
+ { .so = 'n', .lo = "nonblock", .clear = 0, .set = REDIRFD_GOLB_NONBLOCK },
+ { .so = 'b', .lo = "switch-block", .clear = 0, .set = REDIRFD_GOLB_CHANGEMODE },
+ { .so = 'f', .lo = "open", .clear = 0, .set = REDIRFD_GOLB_OPEN },
+ { .so = 'e', .lo = "no-autoimport", .clear = REDIRFD_GOLB_AUTOIMPORT, .set = 0 },
+ { .so = 'E', .lo = "autoimport", .clear = 0, .set = REDIRFD_GOLB_AUTOIMPORT },
+ { .so = 0, .lo = "no-read", .clear = REDIRFD_GOLB_READ, .set = 0 },
+ { .so = 0, .lo = "read", .clear = 0, .set = REDIRFD_GOLB_READ },
+ { .so = 0, .lo = "no-write", .clear = REDIRFD_GOLB_WRITE, .set = 0 },
+ { .so = 0, .lo = "write", .clear = 0, .set = REDIRFD_GOLB_WRITE },
+ { .so = 0, .lo = "no-create", .clear = REDIRFD_GOLB_CREAT, .set = 0 },
+ { .so = 0, .lo = "create", .clear = 0, .set = REDIRFD_GOLB_CREAT },
+ { .so = 0, .lo = "no-append", .clear = REDIRFD_GOLB_APPEND, .set = 0 },
+ { .so = 0, .lo = "append", .clear = 0, .set = REDIRFD_GOLB_APPEND },
+ { .so = 0, .lo = "no-trunc", .clear = REDIRFD_GOLB_TRUNC, .set = 0 },
+ { .so = 0, .lo = "trunc", .clear = 0, .set = REDIRFD_GOLB_TRUNC },
+ { .so = 0, .lo = "no-excl", .clear = REDIRFD_GOLB_EXCL, .set = 0 },
+ { .so = 0, .lo = "excl", .clear = 0, .set = REDIRFD_GOLB_EXCL },
} ;
uint64_t wgolb = 0 ;
unsigned int golc ;
@@ -65,20 +65,20 @@ int main (int argc, char const *const *argv)
golc = gol_main(argc, argv, rgolb, sizeof(rgolb)/sizeof(gol_bool), 0, 0, &wgolb, 0) ;
argc -= golc ; argv += golc ;
if (argc < 3) dieusage() ;
- if (!(wgolb & (GOLB_READ | GOLB_WRITE))) dieusage() ;
- if (!(wgolb & GOLB_OPEN))
+ if (!(wgolb & (REDIRFD_GOLB_READ | REDIRFD_GOLB_WRITE))) dieusage() ;
+ if (!(wgolb & REDIRFD_GOLB_OPEN))
if (!uint0_scan(argv[0], &fdto)) dieusage() ;
flags =
- (wgolb & GOLB_WRITE ? wgolb & GOLB_READ ? O_RDWR : O_WRONLY : O_RDONLY) |
- (wgolb & GOLB_CREAT ? O_CREAT : 0) |
- (wgolb & GOLB_APPEND ? O_APPEND : 0) |
- (wgolb & GOLB_TRUNC ? O_TRUNC : 0) |
- (wgolb & GOLB_EXCL ? O_EXCL : 0) |
- (wgolb & GOLB_NONBLOCK ? O_NONBLOCK : 0) ;
+ (wgolb & REDIRFD_GOLB_WRITE ? wgolb & REDIRFD_GOLB_READ ? O_RDWR : O_WRONLY : O_RDONLY) |
+ (wgolb & REDIRFD_GOLB_CREAT ? O_CREAT : 0) |
+ (wgolb & REDIRFD_GOLB_APPEND ? O_APPEND : 0) |
+ (wgolb & REDIRFD_GOLB_TRUNC ? O_TRUNC : 0) |
+ (wgolb & REDIRFD_GOLB_EXCL ? O_EXCL : 0) |
+ (wgolb & REDIRFD_GOLB_NONBLOCK ? O_NONBLOCK : 0) ;
fd = open3(argv[1], flags, 0666) ;
- if (fd == -1 && wgolb & GOLB_WRITE && errno == ENXIO)
+ if (fd == -1 && wgolb & REDIRFD_GOLB_WRITE && errno == ENXIO)
{
int fdr = open_read(argv[1]) ;
if (fdr == -1) strerr_diefu2sys(111, "open_read ", argv[1]) ;
@@ -87,14 +87,14 @@ int main (int argc, char const *const *argv)
}
if (fd == -1) strerr_diefu2sys(111, "open ", argv[1]) ;
- if (wgolb & GOLB_CHANGEMODE)
- if ((wgolb & GOLB_NONBLOCK ? ndelay_off(fd) : ndelay_on(fd)) == -1)
+ if (wgolb & REDIRFD_GOLB_CHANGEMODE)
+ if ((wgolb & REDIRFD_GOLB_NONBLOCK ? ndelay_off(fd) : ndelay_on(fd)) == -1)
strerr_diefu1sys(111, "change blocking mode") ;
- if (wgolb & GOLB_OPEN)
+ if (wgolb & REDIRFD_GOLB_OPEN)
{
char fmt[UINT_FMT] ;
fmt[uint_fmt(fmt, fd)] = 0 ;
- el_modif_and_exec(argv+2, argv[0], fmt, !!(wgolb & GOLB_AUTOIMPORT)) ;
+ el_modif_and_exec(argv+2, argv[0], fmt, !!(wgolb & REDIRFD_GOLB_AUTOIMPORT)) ;
}
else
{
diff --git a/src/execline/posix-umask.c b/src/execline/umask.c
index 69f4b08..819cf96 100644
--- a/src/execline/posix-umask.c
+++ b/src/execline/umask.c
@@ -2,24 +2,18 @@
#include <stdint.h>
#include <sys/stat.h>
-#include <locale.h>
#include <skalibs/gccattributes.h>
#include <skalibs/bytestr.h>
#include <skalibs/types.h>
-#include <skalibs/sgetopt.h>
+#include <skalibs/envexec.h>
#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-#include <skalibs/exec.h>
-#define USAGE "posix-umask [ -S ] [ mask ] [ prog... ]"
+#define USAGE "umask [ -S ] [ mask ] [ prog... ]"
#define dieusage() strerr_dieusage(100, USAGE)
#define dieout() strerr_diefu1sys(111, "write to stdout")
-
- /* well, unlike posix-cd, at least this one was fun to write */
-
-static inline int pu_output (int sym)
+static inline int umask_output (int sym)
{
mode_t mode = umask(0) ;
size_t m = 0 ;
@@ -43,10 +37,10 @@ static inline int pu_output (int sym)
return 0 ;
}
-static void pu_diesyntax (char const *) gccattr_noreturn ;
-static void pu_diesyntax (char const *s)
+static void umask_diesyntax (char const *) gccattr_noreturn ;
+static void umask_diesyntax (char const *s)
{
- strerr_dief3x(101, "internal parsing error: bad ", s, ". Please submit a bug-report.") ;
+ strerr_dief(101, "internal parsing error: bad ", s, ". Please submit a bug-report.") ;
}
static inline uint8_t pu_cclass (char c)
@@ -73,7 +67,7 @@ static inline uint8_t pu_cclass (char c)
}
}
-static inline uint8_t pu_who_value (char c)
+static inline uint8_t umask_who_value (char c)
{
switch (c)
{
@@ -84,11 +78,11 @@ static inline uint8_t pu_who_value (char c)
case '+' : /* shortcut for when who is empty */
case '-' :
case '=' : return 7 ;
- default : pu_diesyntax("who") ;
+ default : umask_diesyntax("who") ;
}
}
-static inline uint8_t pu_perm_value (char c)
+static inline uint8_t umask_perm_value (char c)
{
switch (c)
{
@@ -98,11 +92,11 @@ static inline uint8_t pu_perm_value (char c)
case 'X' : return 1 ;
case 's' :
case 't' : return 0 ;
- default : pu_diesyntax("perm") ;
+ default : umask_diesyntax("perm") ;
}
}
-static inline unsigned int pu_parsemode (char const *s)
+static inline unsigned int umask_parsemode (char const *s)
{
static uint16_t const table[5][7] =
{
@@ -123,9 +117,9 @@ static inline unsigned int pu_parsemode (char const *s)
char c = *s++ ;
uint16_t what = table[state][pu_cclass(c)] ;
state = what & 7 ;
- if (what & 0x020) who |= pu_who_value(c) ;
+ if (what & 0x020) who |= umask_who_value(c) ;
if (what & 0x080) perm = modes[byte_chr("ogu", 3, c)] ;
- if (what & 0x100) perm |= pu_perm_value(c) ;
+ if (what & 0x100) perm |= umask_perm_value(c) ;
if (what & 0x800)
{
unsigned int i = 3 ;
@@ -135,7 +129,7 @@ static inline unsigned int pu_parsemode (char const *s)
case '-' : modes[i] &= ~perm ; break ;
case '+' : modes[i] |= perm ; break ;
case '=' : modes[i] = perm ; break ;
- default : pu_diesyntax("op") ;
+ default : umask_diesyntax("op") ;
}
}
if (what & 0x040) op = c ;
@@ -148,27 +142,17 @@ static inline unsigned int pu_parsemode (char const *s)
int main (int argc, char const **argv)
{
- int sym = 0 ;
+ static gol_bool const rgolb = { .so = 'S', .lo = "symbolic", .clear = 0, .set = 0x01 } ;
+ uint64_t wgolb = 0 ;
unsigned int mode ;
- PROG = "posix-umask" ;
- setlocale(LC_ALL, "") ; /* totally supported, I swear */
+ PROG = "umask" ;
{
- subgetopt l = SUBGETOPT_ZERO ;
- for (;;)
- {
- int opt = subgetopt_r(argc, argv, "S", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'S' : sym = 1 ; break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
+ unsigned int golc = gol_main(argc, argv, &rgolb, 1, 0, 0, &wgolb, 0) ;
+ argc -= golc ; argv += golc ;
}
- if (!argc) return pu_output(sym) ;
- if (!uint0_oscan(argv[0], &mode)) mode = ~pu_parsemode(argv[0]) ;
+ if (!argc) return umask_output(wgolb & 0x01) ;
+ if (!uint0_oscan(argv[0], &mode)) mode = ~umask_parsemode(argv[0]) ;
umask(mode & 00777) ;
xexec0(argv+1) ;
}
diff --git a/src/execline/posix-umask.txt b/src/execline/umask.txt
index 5bf49a2..5bf49a2 100644
--- a/src/execline/posix-umask.txt
+++ b/src/execline/umask.txt
diff --git a/src/execline/wait.c b/src/execline/wait.c
index 6886c0c..d320d54 100644
--- a/src/execline/wait.c
+++ b/src/execline/wait.c
@@ -15,10 +15,6 @@
#include <execline/config.h>
#include <execline/execline.h>
-#ifdef EXECLINE_PEDANTIC_POSIX
-#include <locale.h>
-#endif
-
#define USAGE "wait [ -I | -i ] [ -a | -o ] [ -r | -t timeout ] { pids... } [ prog... ]"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -157,51 +153,48 @@ static int wait_with_timeout (pid_t *pids, unsigned int n, pid_t *returned, ac_f
enum wait_golb_e
{
- GOLB_INSIST = 0x01,
- GOLB_JUSTONE = 0x02,
- GOLB_REAP = 0x04,
+ WAIT_GOLB_INSIST = 0x01,
+ WAIT_GOLB_JUSTONE = 0x02,
+ WAIT_GOLB_REAP = 0x04,
} ;
enum wait_gola_e
{
- GOLA_TIMEOUT,
- GOLA_N
+ WAIT_GOLA_TIMEOUT,
+ WAIT_GOLA_N
} ;
int main (int argc, char const **argv)
{
static gol_bool const rgolb[] =
{
- { .so = 'I', .lo = "no-insist", .clear = GOLB_INSIST, .set = 0 },
- { .so = 'i', .lo = "insist", .clear = 0, .set = GOLB_INSIST },
- { .so = 'a', .lo = "all", .clear = GOLB_JUSTONE, .set = 0 },
- { .so = 'o', .lo = "one", .clear = 0, .set = GOLB_JUSTONE },
- { .so = 'r', .lo = "reap", .clear = 0, .set = GOLB_REAP },
+ { .so = 'I', .lo = "no-insist", .clear = WAIT_GOLB_INSIST, .set = 0 },
+ { .so = 'i', .lo = "insist", .clear = 0, .set = WAIT_GOLB_INSIST },
+ { .so = 'a', .lo = "all", .clear = WAIT_GOLB_JUSTONE, .set = 0 },
+ { .so = 'o', .lo = "one", .clear = 0, .set = WAIT_GOLB_JUSTONE },
+ { .so = 'r', .lo = "reap", .clear = 0, .set = WAIT_GOLB_REAP },
} ;
static gol_arg const rgola[] =
{
- { .so = 't', .lo = "timeout", .i = GOLA_TIMEOUT },
+ { .so = 't', .lo = "timeout", .i = WAIT_GOLA_TIMEOUT },
} ;
tain tto = TAIN_INFINITE_RELATIVE ;
int argc1 ;
int hasblock = 1 ;
int e ;
uint64_t wgolb = 0 ;
- char const *wgola[GOLA_N] = { 0 } ;
+ char const *wgola[WAIT_GOLA_N] = { 0 } ;
unsigned int golc ;
pid_t pid = -1 ;
PROG = "wait" ;
-#ifdef EXECLINE_PEDANTIC_POSIX
- setlocale(LC_ALL, "") ; /* but of course, dear POSIX */
-#endif
golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ;
argc -= golc ; argv += golc ;
- if (wgolb & GOLB_REAP) wgola[GOLA_TIMEOUT] = "0" ;
- if (wgola[GOLA_TIMEOUT])
+ if (wgolb & WAIT_GOLB_REAP) wgola[WAIT_GOLA_TIMEOUT] = "0" ;
+ if (wgola[WAIT_GOLA_TIMEOUT])
{
unsigned int t = 0 ;
- if (!uint0_scan(wgola[GOLA_TIMEOUT], &t)) dieusage() ;
+ if (!uint0_scan(wgola[WAIT_GOLA_TIMEOUT], &t)) dieusage() ;
tain_from_millisecs(&tto, t) ;
}
@@ -223,9 +216,9 @@ int main (int argc, char const **argv)
}
else pids[0] = 0 ;
- e = wgola[GOLA_TIMEOUT] ? /* wait -t30000 whatever */
- wait_with_timeout(pids, n, &pid, argc1 ? &wait_one_from_list_nohang : &wait_one_nohang, &tto, !!(wgolb & GOLB_JUSTONE), !!(wgolb & GOLB_INSIST)) :
- wgolb & GOLB_JUSTONE ?
+ e = wgola[WAIT_GOLA_TIMEOUT] ? /* wait -t30000 whatever */
+ wait_with_timeout(pids, n, &pid, argc1 ? &wait_one_from_list_nohang : &wait_one_nohang, &tto, !!(wgolb & WAIT_GOLB_JUSTONE), !!(wgolb & WAIT_GOLB_INSIST)) :
+ wgolb & WAIT_GOLB_JUSTONE ?
argc1 ?
wait_one_from_list(pids, n, &pid) : /* wait -o -- 2 3 4 / wait -o -- { 2 3 4 } */
wait_one(&pid) : /* wait -o / wait -o { } */
@@ -234,7 +227,7 @@ int main (int argc, char const **argv)
wait_all() ; /* wait / wait { } */
}
if (!hasblock) _exit(e >= 0 ? e : 127) ;
- if (!(wgolb & GOLB_JUSTONE)) xexec0(argv + argc1 + 1) ;
+ if (!(wgolb & WAIT_GOLB_JUSTONE)) xexec0(argv + argc1 + 1) ;
if (e == -1) xmexec0_n(argv + argc1 + 1, "?\0!", 4, 2) ;
{
diff --git a/tools/gen-multicall.sh b/tools/gen-multicall.sh
index 7a359b4..fe12272 100755
--- a/tools/gen-multicall.sh
+++ b/tools/gen-multicall.sh
@@ -41,7 +41,7 @@ EOF
for i in `ls -1 src/execline/deps-exe` ; do
j=`echo $i | tr - _`
echo
- grep -v '^#include ' < src/execline/${i}.c | grep -vF '/* ISC license. */' | sed -e "s/int main (int argc, char \(.*\)\*argv.*$/int ${j}_main (int argc, char \1*argv, char const *const *envp)/"
+ grep -v '^#include ' < src/execline/${i}.c | grep -vF '/* ISC license. */' | sed -e "s/int main (int argc, char \(.*\)\*argv.*$/static int ${j}_main (int argc, char \1*argv, char const *const *envp)/"
echo
echo '#undef USAGE'
echo '#undef dieusage'
@@ -52,27 +52,13 @@ cat <<EOF
static int execline_main (int, char **, char const *const *) ;
-#ifdef EXECLINE_PEDANTIC_POSIX
-# define CD_FUNC posix_cd_main
-# define UMASK_FUNC posix_umask_main
-#else
-# define CD_FUNC execline_cd_main
-# define UMASK_FUNC execline_umask_main
-#endif
-
static execline_app const execline_apps[] =
{
EOF
-for i in `{ echo cd ; echo execline ; echo umask ; ls -1 src/execline/deps-exe ; } | sort` ; do
+for i in `{ echo execline ; ls -1 src/execline/deps-exe ; } | sort` ; do
j=`echo $i | tr - _`
- if test $i = cd ; then
- echo ' { .name = "cd", .mainf = (emain_func_ref)&CD_FUNC },'
- elif test $i = umask ; then
- echo ' { .name = "umask", .mainf = (emain_func_ref)&UMASK_FUNC },'
- else
- echo " { .name = \"${i}\", .mainf = (emain_func_ref)&${j}_main },"
- fi
+ echo " { .name = \"${i}\", .mainf = (emain_func_ref)&${j}_main },"
done
cat <<EOF