2006-07-15 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / libiberty / pex-djgpp.c
index 6e58e3fd8dcc864b975f7d220a5eb57e73a43387..acaa4c43fdbbe555f7d026c7993a4dc7263afe39 100644 (file)
@@ -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 *,
@@ -62,6 +63,7 @@ const struct pex_funcs funcs =
   pex_djgpp_wait,
   NULL, /* pipe */
   NULL, /* fdopenr */
+  NULL, /* fdopenw */
   NULL  /* cleanup */
 };
 
@@ -110,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;
@@ -195,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)
     {
This page took 0.023085 seconds and 4 git commands to generate.