Imported Upstream version 1.4.19
[platform/upstream/m4.git] / lib / spawn-pipe.h
index 96e7beb..e3b6e04 100644 (file)
@@ -1,5 +1,5 @@
 /* Creation of subprocesses, communicating via pipes.
-   Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006, 2008-2021 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -13,7 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #ifndef _SPAWN_PIPE_H
 #define _SPAWN_PIPE_H
@@ -42,6 +42,19 @@ extern "C" {
    After finishing communication, the caller should call wait_subprocess()
    to get rid of the subprocess in the process table.
 
+   progname is the name of the program to be executed by the subprocess, used
+   for error messages.
+   prog_path is the file name of the program to be executed by the subprocess.
+   If it contains no slashes, a search is conducted in $PATH.  An operating
+   system dependent suffix is added, if necessary.
+   prog_argv is the array of strings that the subprocess shall receive in
+   argv[].  It is a NULL-terminated array.  prog_argv[0] should normally be
+   identical to prog_path.
+
+   If directory is not NULL, the subprocess is started in that directory.  If
+   prog_path is a relative file name, it resolved before changing to that
+   directory.  The current directory of the current process remains unchanged.
+
    If slave_process is true, the child process will be terminated when its
    creator receives a catchable fatal signal or exits normally.  If
    slave_process is false, the child process will continue running in this
@@ -83,7 +96,9 @@ extern "C" {
  * signal and the EPIPE error code.
  */
 extern pid_t create_pipe_out (const char *progname,
-                              const char *prog_path, char **prog_argv,
+                              const char *prog_path,
+                              const char * const *prog_argv,
+                              const char *directory,
                               const char *prog_stdout, bool null_stderr,
                               bool slave_process, bool exit_on_error,
                               int fd[1]);
@@ -96,7 +111,9 @@ extern pid_t create_pipe_out (const char *progname,
  *
  */
 extern pid_t create_pipe_in (const char *progname,
-                             const char *prog_path, char **prog_argv,
+                             const char *prog_path,
+                             const char * const *prog_argv,
+                             const char *directory,
                              const char *prog_stdin, bool null_stderr,
                              bool slave_process, bool exit_on_error,
                              int fd[1]);
@@ -124,13 +141,15 @@ extern pid_t create_pipe_in (const char *progname,
  *    input.  But you are currently busy reading from it.
  */
 extern pid_t create_pipe_bidi (const char *progname,
-                               const char *prog_path, char **prog_argv,
+                               const char *prog_path,
+                               const char * const *prog_argv,
+                               const char *directory,
                                bool null_stderr,
                                bool slave_process, bool exit_on_error,
                                int fd[2]);
 
 /* The name of the "always silent" device.  */
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if defined _WIN32 && ! defined __CYGWIN__
 /* Native Windows API.  */
 # define DEV_NULL "NUL"
 #else