Commit aa76a77e by Richard Kenner

Remove fix_argv kludge.

From-SVN: r10340
parent cf601f01
...@@ -41,6 +41,8 @@ compilation is specified by a string called a "spec". */ ...@@ -41,6 +41,8 @@ compilation is specified by a string called a "spec". */
#include <sys/file.h> /* May get R_OK, etc. on some systems. */ #include <sys/file.h> /* May get R_OK, etc. on some systems. */
#else #else
#include <process.h> #include <process.h>
int __spawnv ();
int __spawnvp ();
#endif #endif
#include "config.h" #include "config.h"
...@@ -2112,54 +2114,20 @@ pexecute (search_flag, program, argv, not_last) ...@@ -2112,54 +2114,20 @@ pexecute (search_flag, program, argv, not_last)
#endif /* not __MSDOS__ and not OS2 and not _WIN32 */ #endif /* not __MSDOS__ and not OS2 and not _WIN32 */
#if defined(OS2) || defined(_WIN32) #if defined(OS2)
#ifdef _WIN32 static int
pexecute (search_flag, program, argv, not_last)
/* This is a kludge to get around the Microsoft C spawn functions' propensity int search_flag;
to remove the outermost set of double quotes from all arguments. */ char *program;
char *argv[];
const char * const int not_last;
fix_argv (argvec)
char **argvec;
{ {
int i; return (search_flag ? spawnv : spawnvp) (1, program, argv);
for (i = 1; argvec[i] != 0; i++)
{
int len, j;
char *temp, *newtemp;
temp = argvec[i];
len = strlen (temp);
for (j = 0; j < len; j++)
{
if (temp[j] == '"')
{
newtemp = xmalloc (len + 2);
strncpy (newtemp, temp, j);
newtemp [j] = '\\';
strncpy (&newtemp [j+1], &temp [j], len-j);
newtemp [len+1] = 0;
temp = newtemp;
len++;
j++;
}
}
argvec[i] = temp;
}
return (const char* const*) argvec;
} }
#endif /* OS2 */
#define FIX_ARGV(a) fix_argv(a) #if defined(_WIN32)
#else
#define FIX_ARGV(a) a
#endif
static int static int
pexecute (search_flag, program, argv, not_last) pexecute (search_flag, program, argv, not_last)
...@@ -2168,9 +2136,9 @@ pexecute (search_flag, program, argv, not_last) ...@@ -2168,9 +2136,9 @@ pexecute (search_flag, program, argv, not_last)
char *argv[]; char *argv[];
int not_last; int not_last;
{ {
return (search_flag ? spawnv : spawnvp) (1, program, FIX_ARGV (argv)); return (search_flag ? __spawnv : __spawnvp) (1, program, argv);
} }
#endif /* OS2 or _WIN32 */ #endif /* _WIN32 */
/* Execute the command specified by the arguments on the current line of spec. /* Execute the command specified by the arguments on the current line of spec.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment