]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix up another quoted commandline issue (this one being in commandline reconstruction...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Sep 2004 23:03:30 +0000 (23:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Sep 2004 23:03:30 +0000 (23:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4501 d7cf8633-e32d-0410-b094-e92efae38249

common.c

index 89d73de3d0cfc7823805cd620cb2de7c6a53ee0c..587aa08c8169e9070b345fedababb5e78f03fab5 100644 (file)
--- a/common.c
+++ b/common.c
@@ -774,8 +774,19 @@ void COM_InitArgv (void)
        for (j = 0;(j < MAX_NUM_ARGVS) && (j < com_argc);j++)
        {
                i = 0;
-               while ((n < (CMDLINE_LENGTH - 1)) && com_argv[j][i])
-                       com_cmdline[n++] = com_argv[j][i++];
+               if (strstr(com_argv[j], " "))
+               {
+                       // arg contains whitespace, store quotes around it
+                       com_cmdline[n++] = '\"';
+                       while ((n < (CMDLINE_LENGTH - 1)) && com_argv[j][i])
+                               com_cmdline[n++] = com_argv[j][i++];
+                       com_cmdline[n++] = '\"';
+               }
+               else
+               {
+                       while ((n < (CMDLINE_LENGTH - 1)) && com_argv[j][i])
+                               com_cmdline[n++] = com_argv[j][i++];
+               }
                if (n < (CMDLINE_LENGTH - 1))
                        com_cmdline[n++] = ' ';
                else