From 72dd49d7dd07ba4cae13ee1249fd58550991c188 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 30 Dec 2019 20:31:24 +0000 Subject: Rename cd/umask to execline-cd/execline-umask, make symlinks, etc. --- .gitignore | 5 ++-- NEWS | 9 ++++-- configure | 5 ++++ doc/cd.html | 50 --------------------------------- doc/execline-cd.html | 54 ++++++++++++++++++++++++++++++++++++ doc/execline-umask.html | 50 +++++++++++++++++++++++++++++++++ doc/index.html | 4 +-- doc/posix-cd.html | 23 ++++++++------- doc/posix-umask.html | 22 +++++++++------ doc/umask.html | 48 -------------------------------- doc/upgrade.html | 6 ++++ package/deps.mak | 12 ++++---- package/targets.mak | 22 +++++++++------ src/execline/cd.c | 16 ----------- src/execline/deps-exe/cd | 1 - src/execline/deps-exe/execline-cd | 1 + src/execline/deps-exe/execline-umask | 1 + src/execline/deps-exe/umask | 1 - src/execline/execline-cd.c | 16 +++++++++++ src/execline/execline-umask.c | 18 ++++++++++++ src/execline/umask.c | 18 ------------ src/execline/wait.c | 10 +++++++ 22 files changed, 217 insertions(+), 175 deletions(-) delete mode 100644 doc/cd.html create mode 100644 doc/execline-cd.html create mode 100644 doc/execline-umask.html delete mode 100644 doc/umask.html delete mode 100644 src/execline/cd.c delete mode 100644 src/execline/deps-exe/cd create mode 100644 src/execline/deps-exe/execline-cd create mode 100644 src/execline/deps-exe/execline-umask delete mode 100644 src/execline/deps-exe/umask create mode 100644 src/execline/execline-cd.c create mode 100644 src/execline/execline-umask.c delete mode 100644 src/execline/umask.c diff --git a/.gitignore b/.gitignore index 0631586..7103ade 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ /src/include/execline/config.h /background /backtick -/cd /define /dollarat /elgetopt @@ -16,6 +15,8 @@ /envfile /exec /execlineb +/execline-cd +/execline-umask /exit /export /fdblock @@ -43,6 +44,7 @@ /pipeline /piperw /posix-cd +/posix-umask /redirfd /runblock /shift @@ -52,4 +54,3 @@ /unexport /wait /withstdinas - diff --git a/NEWS b/NEWS index 7ae513e..6e42862 100644 --- a/NEWS +++ b/NEWS @@ -5,9 +5,12 @@ In 2.6.0.0 - The dollarat program now has its conflicting -0 and -d options handled in the conventional way, with rightmost priority. - - New binary: posix-umask. With --enable-pedantic-posix, -umask is a symbolic link to posix-umask. And, hopefully, this -completes the "make execline POSIX-compliant" chapter. + - New binary: posix-umask. + - cd renamed to execline-cd, umask renamed to execline-umask + - With --enable-pedantic-posix, umask is a symbolic link to +posix-umask and cd is a symbolic link to posix-cd. Without this +option, umask is a symbolic link to execline-umask and cd is +a symbolic link to execline-cd. In 2.5.3.0 diff --git a/configure b/configure index 39777fe..f2fb757 100755 --- a/configure +++ b/configure @@ -494,6 +494,11 @@ fi echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\"" 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>&- echo " ... done." diff --git a/doc/cd.html b/doc/cd.html deleted file mode 100644 index fe64c19..0000000 --- a/doc/cd.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - execline: the cd command - - - - - - -

-execline
-Software
-skarnet.org -

- -

The cd program

- -

-cd changes the current working directory to a -given directory, then executes a program. -

- -

Interface

- -
-     cd dir prog...
-
- -

-cd performs a -chdir() -system call on dir, then execs into prog.... -

- -

Notes

- - - - - - diff --git a/doc/execline-cd.html b/doc/execline-cd.html new file mode 100644 index 0000000..911eb2a --- /dev/null +++ b/doc/execline-cd.html @@ -0,0 +1,54 @@ + + + + + + execline: the execline-cd command + + + + + + +

+execline
+Software
+skarnet.org +

+ +

The execline-cd program

+ +

+execline-cd changes the current working directory to a +given directory, then executes a program. +

+ +

Interface

+ +
+     execline-cd dir prog...
+
+ +

+execline-cd performs a +chdir() +system call on dir, then execs into prog.... +

+ +

Notes

+ + + + + + diff --git a/doc/execline-umask.html b/doc/execline-umask.html new file mode 100644 index 0000000..f01343d --- /dev/null +++ b/doc/execline-umask.html @@ -0,0 +1,50 @@ + + + + + + execline: the execline-umask command + + + + + + +

+execline
+Software
+skarnet.org +

+ +

The execline-umask program

+ +

+execline-umask sets the umask (file creation mask), +then executes a program. +

+ +

Interface

+ +
+     execline-umask mask prog...
+
+ +

+execline-umask sets the current umask to mask, +then execs into prog.... +

+ +

Notes

+ + + + + diff --git a/doc/index.html b/doc/index.html index d93f704..498bb13 100644 --- a/doc/index.html +++ b/doc/index.html @@ -125,9 +125,9 @@ to your installation: the shebang lines for your system might be something like (Process state control)

in 2.5.3.0

diff --git a/package/deps.mak b/package/deps.mak index f944bc7..3aac760 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -4,7 +4,6 @@ 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/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 @@ -13,6 +12,8 @@ src/execline/elglob.o src/execline/elglob.lo: src/execline/elglob.c src/include- 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.o src/execline/export.lo: src/execline/export.c @@ -44,7 +45,6 @@ src/execline/runblock.o src/execline/runblock.lo: src/execline/runblock.c src/in 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/execline.h src/execline/withstdinas.o src/execline/withstdinas.lo: src/execline/withstdinas.c @@ -78,8 +78,6 @@ background: EXTRA_LIBS := -lskarnet ${SPAWN_LIB} background: src/execline/background.o ${LIBEXECLINE} backtick: EXTRA_LIBS := -lskarnet ${SPAWN_LIB} backtick: src/execline/backtick.o ${LIBEXECLINE} -cd: EXTRA_LIBS := -lskarnet -cd: src/execline/cd.o define: EXTRA_LIBS := -lskarnet define: src/execline/define.o ${LIBEXECLINE} dollarat: EXTRA_LIBS := -lskarnet @@ -96,6 +94,10 @@ envfile: EXTRA_LIBS := -lskarnet envfile: src/execline/envfile.o exec: EXTRA_LIBS := -lskarnet exec: src/execline/exec.o +execline-cd: EXTRA_LIBS := -lskarnet +execline-cd: src/execline/execline-cd.o +execline-umask: EXTRA_LIBS := -lskarnet +execline-umask: src/execline/execline-umask.o execlineb: EXTRA_LIBS := -lskarnet execlineb: src/execline/execlineb.o ${LIBEXECLINE} exit: EXTRA_LIBS := -lskarnet @@ -158,8 +160,6 @@ trap: EXTRA_LIBS := -lskarnet ${SPAWN_LIB} trap: src/execline/trap.o ${LIBEXECLINE} tryexec: EXTRA_LIBS := -lskarnet tryexec: src/execline/tryexec.o ${LIBEXECLINE} -umask: EXTRA_LIBS := -lskarnet -umask: src/execline/umask.o unexport: EXTRA_LIBS := -lskarnet unexport: src/execline/unexport.o wait: EXTRA_LIBS := -lskarnet diff --git a/package/targets.mak b/package/targets.mak index b502988..be4764d 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -1,7 +1,6 @@ BIN_TARGETS := \ background \ backtick \ -cd \ define \ dollarat \ elgetopt \ @@ -11,6 +10,8 @@ emptyenv \ envfile \ exec \ execlineb \ +execline-cd \ +execline-umask \ exit \ export \ fdblock \ @@ -36,12 +37,13 @@ multidefine \ multisubstitute \ pipeline \ piperw \ +posix-cd \ +posix-umask \ redirfd \ runblock \ shift \ trap \ tryexec \ -umask \ unexport \ wait \ withstdinas @@ -51,13 +53,15 @@ LIBEXEC_TARGETS := LIB_DEFS := EXECLINE=execline ifeq ($(PEDANTIC_POSIX),1) +PEDANTIC_PREFIX := posix +else +PEDANTIC_PREFIX := execline +endif -BIN_TARGETS += posix-cd posix-umask - -$(DESTDIR)$(bindir)/cd: $(DESTDIR)$(bindir)/posix-cd - exec ./tools/install.sh -l posix-cd $(DESTDIR)$(bindir)/cd +install-bin: $(DESTDIR)$(bindir)/cd $(DESTDIR)$(bindir)/umask -$(DESTDIR)$(bindir)/umask: $(DESTDIR)$(bindir)/posix-umask - exec ./tools/install.sh -l posix-umask $(DESTDIR)$(bindir)/umask +$(DESTDIR)$(bindir)/cd: $(DESTDIR)$(bindir)/$(PEDANTIC_PREFIX)-cd + exec ./tools/install.sh -l $(PEDANTIC_PREFIX)-cd $(DESTDIR)$(bindir)/cd -endif +$(DESTDIR)$(bindir)/umask: $(DESTDIR)$(bindir)/$(PEDANTIC_PREFIX)-umask + exec ./tools/install.sh -l $(PEDANTIC_PREFIX)-umask $(DESTDIR)$(bindir)/umask diff --git a/src/execline/cd.c b/src/execline/cd.c deleted file mode 100644 index 62b877c..0000000 --- a/src/execline/cd.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ISC license. */ - -#include -#include -#include - -#define USAGE "cd path prog..." - -int main (int argc, char const *const *argv, char const *const *envp) -{ - PROG = "cd" ; - if (argc < 3) strerr_dieusage(100, USAGE) ; - if (chdir(argv[1]) == -1) - strerr_diefu2sys(111, "chdir to ", argv[1]) ; - xpathexec_run(argv[2], argv+2, envp) ; -} diff --git a/src/execline/deps-exe/cd b/src/execline/deps-exe/cd deleted file mode 100644 index e7187fe..0000000 --- a/src/execline/deps-exe/cd +++ /dev/null @@ -1 +0,0 @@ --lskarnet diff --git a/src/execline/deps-exe/execline-cd b/src/execline/deps-exe/execline-cd new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/execline/deps-exe/execline-cd @@ -0,0 +1 @@ +-lskarnet diff --git a/src/execline/deps-exe/execline-umask b/src/execline/deps-exe/execline-umask new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/execline/deps-exe/execline-umask @@ -0,0 +1 @@ +-lskarnet diff --git a/src/execline/deps-exe/umask b/src/execline/deps-exe/umask deleted file mode 100644 index e7187fe..0000000 --- a/src/execline/deps-exe/umask +++ /dev/null @@ -1 +0,0 @@ --lskarnet diff --git a/src/execline/execline-cd.c b/src/execline/execline-cd.c new file mode 100644 index 0000000..8f308f3 --- /dev/null +++ b/src/execline/execline-cd.c @@ -0,0 +1,16 @@ +/* ISC license. */ + +#include +#include +#include + +#define USAGE "cd path prog..." + +int main (int argc, char const *const *argv, char const *const *envp) +{ + PROG = "execline-cd" ; + if (argc < 3) strerr_dieusage(100, USAGE) ; + if (chdir(argv[1]) == -1) + strerr_diefu2sys(111, "chdir to ", argv[1]) ; + xpathexec_run(argv[2], argv+2, envp) ; +} diff --git a/src/execline/execline-umask.c b/src/execline/execline-umask.c new file mode 100644 index 0000000..a7888a6 --- /dev/null +++ b/src/execline/execline-umask.c @@ -0,0 +1,18 @@ +/* ISC license. */ + +#include +#include +#include +#include + +#define USAGE "umask value prog..." + +int main (int argc, char const *const *argv, char const *const *envp) +{ + 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) ; + xpathexec_run(argv[2], argv+2, envp) ; +} diff --git a/src/execline/umask.c b/src/execline/umask.c deleted file mode 100644 index f74f845..0000000 --- a/src/execline/umask.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ISC license. */ - -#include -#include -#include -#include - -#define USAGE "umask value prog..." - -int main (int argc, char const *const *argv, char const *const *envp) -{ - unsigned int m ; - PROG = "umask" ; - if (argc < 3) strerr_dieusage(100, USAGE) ; - if (!uint_oscan(argv[1], &m)) strerr_dieusage(100, USAGE) ; - umask(m) ; - xpathexec_run(argv[2], argv+2, envp) ; -} diff --git a/src/execline/wait.c b/src/execline/wait.c index 2a2ead2..726cd52 100644 --- a/src/execline/wait.c +++ b/src/execline/wait.c @@ -1,7 +1,13 @@ /* ISC license. */ +#include + #include #include +#ifdef EXECLINE_PEDANTIC_POSIX +#include +#endif + #include #include #include @@ -9,6 +15,7 @@ #include #include #include + #include #define USAGE "wait [ -I | -i ] [ -r | -t timeout ] { pids... }" @@ -109,6 +116,9 @@ int main (int argc, char const **argv, char const *const *envp) int r ; int hasblock ; PROG = "wait" ; +#ifdef EXECLINE_PEDANTIC_POSIX + setlocale(LC_ALL, "") ; /* but of course, dear POSIX */ +#endif { subgetopt_t l = SUBGETOPT_ZERO ; unsigned int t = 0 ; -- cgit 1.4.1