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". */
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
#else
#include <process.h>
int __spawnv ();
int __spawnvp ();
#endif
#include "config.h"
......@@ -2112,54 +2114,20 @@ pexecute (search_flag, program, argv, not_last)
#endif /* not __MSDOS__ and not OS2 and not _WIN32 */
#if defined(OS2) || defined(_WIN32)
#if defined(OS2)
#ifdef _WIN32
/* This is a kludge to get around the Microsoft C spawn functions' propensity
to remove the outermost set of double quotes from all arguments. */
const char * const
fix_argv (argvec)
char **argvec;
static int
pexecute (search_flag, program, argv, not_last)
int search_flag;
char *program;
char *argv[];
int not_last;
{
int i;
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;
return (search_flag ? spawnv : spawnvp) (1, program, argv);
}
#endif /* OS2 */
#define FIX_ARGV(a) fix_argv(a)
#else
#define FIX_ARGV(a) a
#endif
#if defined(_WIN32)
static int
pexecute (search_flag, program, argv, not_last)
......@@ -2168,9 +2136,9 @@ pexecute (search_flag, program, argv, not_last)
char *argv[];
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.
......
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