@@ -710,13 +710,37 @@ quot (const char *string)
buf = (char *) xmalloc (buflen);
}
+#if defined (_WIN32) && !defined (__CYGWIN__)
+ /* For Windows shells, quote "like this". */
+ {
+ bool quoted = false;
+
+ dest = buf;
+ if (strchr (string, ' '))
+ {
+ quoted = true;
+ *dest++ = '"';
+ }
+
+ for (src = string; *src; src++, dest++)
+ {
+ /* Escape-protect embedded double quotes. */
+ if (quoted && *src == '"')
+ *dest++ = '\\';
+ *dest = *src;
+ }
+
+ if (quoted)
+ *dest++ = '"';
+ }
+#else
for (src = string, dest = buf; *src; src++, dest++)
{
if (*src == '(' || *src == ')' || *src == ' ')
*dest++ = '\\';
*dest = *src;
}
-
+#endif
*dest = 0;
return buf;
}
@@ -884,13 +908,7 @@ main (int argc, char **argv)
break;
case OPTION_PREPROCESSOR:
- if (strchr (optarg, ' '))
- {
- if (asprintf (& preprocessor, "\"%s\"", optarg) == -1)
- preprocessor = optarg;
- }
- else
- preprocessor = optarg;
+ preprocessor = optarg;
break;
case OPTION_PREPROCESSOR_ARG: