diff options
author | Eric Blake <ebb9@byu.net> | 2009-03-02 15:08:31 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-03-13 07:40:27 -0600 |
commit | 979fcdc4cfe76c0df7e3ec6450df03a366e5f3b7 (patch) | |
tree | 66b929fa917c7bb67affbe4dc1d9299a332bc9da /modules | |
parent | 54a1ab447fc79ed0f817e6b8e140ac2fd49b6e62 (diff) | |
download | m4-979fcdc4cfe76c0df7e3ec6450df03a366e5f3b7.tar.gz |
Allow configuration choice in syscmd shell.
* ltdl/m4/m4-syscmd.m4: New file.
* configure.ac (M4_SYSCMD): Use it to provide
--with-syscmd-shell.
(AC_CHECK_HEADERS_ONCE): No longer need to worry about
<sys/wait.h>.
* modules/m4.c (syscmd): Use it to avoid hard-coding the shell
location.
* modules/gnu.c (esyscmd): Likewise.
* doc/m4.texinfo (Syscmd, Esyscmd): Document this.
* README: Document new configure option.
* NEWS: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit 060b5319b3452a2464eea1defc5fae608a12b574)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gnu.c | 13 | ||||
-rw-r--r-- | modules/m4.c | 13 |
2 files changed, 12 insertions, 14 deletions
diff --git a/modules/gnu.c b/modules/gnu.c index e833f552..5650c727 100644 --- a/modules/gnu.c +++ b/modules/gnu.c @@ -639,9 +639,6 @@ M4BUILTIN_HANDLER (debugmode) } -/* FIXME */ -#define SYSCMD_SHELL "/bin/sh" - /* Same as the sysymd builtin from m4.c module, but expand to the output of SHELL-COMMAND. */ @@ -666,7 +663,6 @@ M4BUILTIN_HANDLER (esyscmd) int sig_status; const char *prog_args[4] = { "sh", "-c" }; const char *caller; - const char *shell = SYSCMD_SHELL; if (m4_get_safer_opt (context)) { @@ -686,13 +682,16 @@ M4BUILTIN_HANDLER (esyscmd) m4_sysval_flush (context, false); #if W32_NATIVE - shell = prog_args[0] = "cmd"; - prog_args[1] = "/c"; + if (strstr (M4_SYSCMD_SHELL, "cmd")) + { + prog_args[0] = "cmd"; + prog_args[1] = "/c"; + } #endif prog_args[2] = cmd; caller = m4_info_name (me); errno = 0; - child = create_pipe_in (caller, shell/*FIXME*/, (char **) prog_args, + child = create_pipe_in (caller, M4_SYSCMD_SHELL, (char **) prog_args, NULL, false, true, false, &fd); if (child == -1) { diff --git a/modules/m4.c b/modules/m4.c index d4a58702..394abf3d 100644 --- a/modules/m4.c +++ b/modules/m4.c @@ -409,9 +409,6 @@ M4BUILTIN_HANDLER (defn) /* This section contains macros to handle the builtins "syscmd" and "sysval". */ -/* FIXME */ -#define SYSCMD_SHELL "/bin/sh" - /* Exit code from last "syscmd" command. */ /* FIXME - we should preserve this value across freezing. See http://lists.gnu.org/archive/html/bug-m4/2006-06/msg00059.html @@ -483,7 +480,6 @@ M4BUILTIN_HANDLER (syscmd) int status; int sig_status; const char *prog_args[4] = { "sh", "-c" }; - const char *shell = SYSCMD_SHELL; if (m4_get_safer_opt (context)) { @@ -502,12 +498,15 @@ M4BUILTIN_HANDLER (syscmd) } m4_sysval_flush (context, false); #if W32_NATIVE - shell = prog_args[0] = "cmd"; - prog_args[1] = "/c"; + if (strstr (M4_SYSCMD_SHELL, "cmd")) + { + prog_args[0] = "cmd"; + prog_args[1] = "/c"; + } #endif prog_args[2] = cmd; errno = 0; - status = execute (m4_info_name (me), shell/*FIXME*/, (char **) prog_args, + status = execute (m4_info_name (me), M4_SYSCMD_SHELL, (char **) prog_args, false, false, false, false, true, false, &sig_status); if (sig_status) { |