diff options
author | Mark Shinwell <shinwell@codesourcery.com> | 2006-06-01 10:30:51 +0000 |
---|---|---|
committer | Mark Shinwell <shinwell@gcc.gnu.org> | 2006-06-01 10:30:51 +0000 |
commit | ea60341e32df03bcef5985ec908b1f38e9a7892a (patch) | |
tree | 65214f176ae027d313b5e5f7a60900e75c43d3ef /libiberty/pex-djgpp.c | |
parent | 7d6d782d02ed4320a81e7e1d9caf526d583aae0a (diff) | |
download | gcc-ea60341e32df03bcef5985ec908b1f38e9a7892a.tar.gz |
Patch to provide pex_run_in_environment.
* include/libiberty.h: Declare pex_run_in_environment.
libiberty:
* pex-common.c: New function pex_run_in_environment.
* pex-common.h: Add environment parameter to exec_child.
* pex-msdos.c: Add environment parameter to pex_msdos_exec_child.
* pex-djgpp.c: Add environment parameter to pex_djgpp_exec_child.
(pex_djgpp_exec_child): Pass environment to child process.
* pex-unix.c: Add environment parameter to pex_unix_exec_child.
(pex_unix_exec_child): Pass environment to child process.
* pex-win32.c: Add environment parameter to pex_win32_exec_child.
New function env_compare for comparing VAR=VALUE pairs.
(win32_spawn): Assemble environment block and pass to CreateProcess.
(spawn_script): Pass environment through to win32_spawn.
(pex_win32_exec_child): Pass environment through to spawn_script and
win32_spawn.
* functions.texi: Regenerate.
* pexecute.txh: Document pex_run_in_environment.
From-SVN: r114302
Diffstat (limited to 'libiberty/pex-djgpp.c')
-rw-r--r-- | libiberty/pex-djgpp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c index 17fbf2cc7e4..acaa4c43fdb 100644 --- a/libiberty/pex-djgpp.c +++ b/libiberty/pex-djgpp.c @@ -45,7 +45,8 @@ extern int errno; static int pex_djgpp_open_read (struct pex_obj *, const char *, int); static int pex_djgpp_open_write (struct pex_obj *, const char *, int); static long pex_djgpp_exec_child (struct pex_obj *, int, const char *, - char * const *, int, int, int, + char * const *, char * const *, + int, int, int, const char **, int *); static int pex_djgpp_close (struct pex_obj *, int); static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *, @@ -111,7 +112,8 @@ pex_djgpp_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd) static long pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable, - char * const * argv, int in, int out, int errdes, + char * const * argv, char * const * env, + int in, int out, int errdes, const char **errmsg, int *err) { int org_in, org_out, org_errdes; @@ -196,8 +198,12 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable, } } - status = (((flags & PEX_SEARCH) != 0 ? spawnvp : spawnv) - (P_WAIT, executable, (char * const *) argv)); + if (env) + status = (((flags & PEX_SEARCH) != 0 ? spawnvpe : spawnve) + (P_WAIT, executable, argv, env)); + else + status = (((flags & PEX_SEARCH) != 0 ? spawnvp : spawnv) + (P_WAIT, executable, argv)); if (status == -1) { |