1 | /* gnome-exec.h - Execute some command. |
---|
2 | |
---|
3 | Copyright (C) 1998 Tom Tromey |
---|
4 | Copyright (C) 1999, 2000 Red Hat, Inc. |
---|
5 | All rights reserved. |
---|
6 | |
---|
7 | This file is part of the Gnome Library. |
---|
8 | |
---|
9 | The Gnome Library is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU Library General Public License as |
---|
11 | published by the Free Software Foundation; either version 2 of the |
---|
12 | License, or (at your option) any later version. |
---|
13 | |
---|
14 | The Gnome Library is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | Library General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Library General Public |
---|
20 | License along with the Gnome Library; see the file COPYING.LIB. If not, |
---|
21 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
22 | Boston, MA 02111-1307, USA. */ |
---|
23 | /* |
---|
24 | @NOTATION@ |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef GNOME_EXEC_H |
---|
28 | #define GNOME_EXEC_H |
---|
29 | |
---|
30 | #include <glib.h> |
---|
31 | |
---|
32 | G_BEGIN_DECLS |
---|
33 | |
---|
34 | |
---|
35 | /* Fork and execute some program in the background. Returns -1 on |
---|
36 | error. Returns PID on success. Should correctly report errno |
---|
37 | returns from a failing child invocation. DIR is the directory in |
---|
38 | which to exec the child; if NULL the current directory is used. |
---|
39 | Searches $PATH to find the child. */ |
---|
40 | int gnome_execute_async (const char *dir, int argc, char * const argv[]); |
---|
41 | int gnome_execute_async_fds (const char *dir, int argc, char * const argv[], |
---|
42 | gboolean close_fds); |
---|
43 | |
---|
44 | |
---|
45 | /* Like gnome_execute_async, but each string in ENVV is added to the |
---|
46 | child's environment. If you want to set the environment exactly, |
---|
47 | you must set the global `environ' variable instead. If ENVV is |
---|
48 | NULL, the child inherits the parent's environment. In this case, |
---|
49 | the value of ENVC is ignored. */ |
---|
50 | int gnome_execute_async_with_env (const char *dir, |
---|
51 | int argc, char * const argv[], |
---|
52 | int envc, char * const envv[]); |
---|
53 | int gnome_execute_async_with_env_fds (const char *dir, int argc, |
---|
54 | char * const argv[], int envc, |
---|
55 | char * const envv[], gboolean close_fds); |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | /* Fork and execute commandline using the user's shell. Calls |
---|
60 | gnome_execute_async so it does the same things and returns |
---|
61 | the same things. */ |
---|
62 | int gnome_execute_shell (const char *dir, const char *commandline); |
---|
63 | int gnome_execute_shell_fds (const char *dir, const char *commandline, |
---|
64 | gboolean close_fds); |
---|
65 | |
---|
66 | /* prepend the terminal command to a vector */ |
---|
67 | void gnome_prepend_terminal_to_vector (int *argc, char ***argv); |
---|
68 | |
---|
69 | /* run a shell in the terminal, here commandline can be NULL |
---|
70 | * for just a shell, unlike in gnome_execute_shell */ |
---|
71 | int gnome_execute_terminal_shell (const char *dir, const char *commandline); |
---|
72 | int gnome_execute_terminal_shell_fds (const char *dir, |
---|
73 | const char *commandline, |
---|
74 | gboolean close_fds); |
---|
75 | |
---|
76 | G_END_DECLS |
---|
77 | |
---|
78 | #endif /* GNOME_EXEC_H */ |
---|