From: Richard Kenner Date: Tue, 21 Feb 1995 23:52:14 +0000 (-0500) Subject: (fix_argv): Rewrite. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ce3c2a19ae54df4b5afc8f24be3e75ee9005528;p=gcc.git (fix_argv): Rewrite. From-SVN: r9013 --- diff --git a/gcc/gcc.c b/gcc/gcc.c index afa20ef2b3e..74b2625e10a 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -2163,39 +2163,42 @@ pexecute (search_flag, program, argv, not_last) #ifdef WINNT -char ** +/* 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 + char **argvec; { - 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; - free (temp); - temp = newtemp; - len++; - j++; - } - } - - argvec[i] = temp; - } - - return argvec; + 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; + free (temp); + temp = newtemp; + len++; + j++; + } + } + + argvec[i] = temp; + } + + return (const char* const*) argvec; } #define FIX_ARGV(a) fix_argv(a) @@ -2204,7 +2207,7 @@ fix_argv (argvec) #define FIX_ARGV(a) a -#endif /* OS2 or WINNT */ +#endif static int pexecute (search_flag, program, argv, not_last)