xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/gnulib-lib/execute.h (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos /* Creation of autonomous subprocesses.
2*946379e7Schristos    Copyright (C) 2001-2003 Free Software Foundation, Inc.
3*946379e7Schristos    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
4*946379e7Schristos 
5*946379e7Schristos    This program is free software; you can redistribute it and/or modify
6*946379e7Schristos    it under the terms of the GNU General Public License as published by
7*946379e7Schristos    the Free Software Foundation; either version 2, or (at your option)
8*946379e7Schristos    any later version.
9*946379e7Schristos 
10*946379e7Schristos    This program is distributed in the hope that it will be useful,
11*946379e7Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*946379e7Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*946379e7Schristos    GNU General Public License for more details.
14*946379e7Schristos 
15*946379e7Schristos    You should have received a copy of the GNU General Public License
16*946379e7Schristos    along with this program; if not, write to the Free Software Foundation,
17*946379e7Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18*946379e7Schristos 
19*946379e7Schristos #ifndef _EXECUTE_H
20*946379e7Schristos #define _EXECUTE_H
21*946379e7Schristos 
22*946379e7Schristos #include <stdbool.h>
23*946379e7Schristos 
24*946379e7Schristos /* Execute a command, optionally redirecting any of the three standard file
25*946379e7Schristos    descriptors to /dev/null.  Return its exit code.
26*946379e7Schristos    If it didn't terminate correctly, exit if exit_on_error is true, otherwise
27*946379e7Schristos    return 127.
28*946379e7Schristos    If ignore_sigpipe is true, consider a subprocess termination due to SIGPIPE
29*946379e7Schristos    as equivalent to a success.  This is suitable for processes whose only
30*946379e7Schristos    purpose is to write to standard output.
31*946379e7Schristos    If slave_process is true, the child process will be terminated when its
32*946379e7Schristos    creator receives a catchable fatal signal.
33*946379e7Schristos    It is recommended that no signal is blocked or ignored while execute()
34*946379e7Schristos    is called.  See pipe.h for the reason.  */
35*946379e7Schristos extern int execute (const char *progname,
36*946379e7Schristos 		    const char *prog_path, char **prog_argv,
37*946379e7Schristos 		    bool ignore_sigpipe,
38*946379e7Schristos 		    bool null_stdin, bool null_stdout, bool null_stderr,
39*946379e7Schristos 		    bool slave_process, bool exit_on_error);
40*946379e7Schristos 
41*946379e7Schristos #endif /* _EXECUTE_H */
42