Author: cfinck
Date: Mon Jul 7 09:00:29 2008
New Revision: 34356
URL:
http://svn.reactos.org/svn/reactos?rev=34356&view=rev
Log:
Fixed and reformatted argvtos() function: The previous one did not check if an argument
already contains quotation marks.
Therefore pathes containing spaces, which were already quoted, were quoted again, so that
gcc handled the full path as several arguments.
Modified:
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] Mon Jul 7
09:00:29 2008
@@ -21,28 +21,34 @@
#ifdef _WIN32
static char *argvtos(char **argv)
{
- int i, len;
- char *ptr, *str;
-
- for (i = 0, len = 0; argv[i]; i++) {
- len += strlen(argv[i]) + 3;
- }
-
- str = ptr = (char *)malloc(len + 1);
- if (str == NULL)
- return NULL;
-
- for (i = 0; argv[i]; i++) {
- len = strlen(argv[i]);
- *ptr++ = '"';
- memcpy(ptr, argv[i], len);
- ptr += len;
- *ptr++ = '"';
- *ptr++ = ' ';
- }
- *ptr = 0;
-
- return str;
+ int i, len;
+ char *ptr, *str;
+
+ for (i = 0, len = 0; argv[i]; i++)
+ len += strlen(argv[i]) + 3;
+
+ str = ptr = (char *)malloc(len + 1);
+ if (str == NULL)
+ return NULL;
+
+ for (i = 0; argv[i]; i++)
+ {
+ len = strlen(argv[i]);
+
+ if(argv[i][0] != '"')
+ *ptr++ = '"';
+
+ memcpy(ptr, argv[i], len);
+ ptr += len;
+
+ if(argv[i][len - 1] != '"')
+ *ptr++ = '"';
+
+ *ptr++ = ' ';
+ }
+ *ptr = 0;
+
+ return str;
}
#endif