]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
another attempt to fix quoted strings in windows commandline, but more so a cleanup
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Sep 2004 00:45:46 +0000 (00:45 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Sep 2004 00:45:46 +0000 (00:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4469 d7cf8633-e32d-0410-b094-e92efae38249

sys_win.c

index 8dd8299838890579dca1ba5d13e0f2fc99053def..e261d04ddf5d046c9db2af7cb07eb8b02401e274 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -356,31 +356,31 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
                while (*lpCmdLine && *lpCmdLine <= ' ')
                        lpCmdLine++;
 
-               if (*lpCmdLine)
+               if (!*lpCmdLine)
+                       break;
+
+               if (*lpCmdLine == '\"')
                {
-                       if (*lpCmdLine == '\"')
-                       {
-                               // quoted string
+                       // quoted string
+                       lpCmdLine++;
+                       argv[com_argc] = lpCmdLine;
+                       com_argc++;
+                       while (*lpCmdLine && (*lpCmdLine != '\"'))
                                lpCmdLine++;
-                               argv[com_argc] = lpCmdLine;
-                               com_argc++;
-                               while (*lpCmdLine && (*lpCmdLine != '\"'))
-                                       lpCmdLine++;
-                       }
-                       else
-                       {
-                               // unquoted word
-                               argv[com_argc] = lpCmdLine;
-                               com_argc++;
-                               while (*lpCmdLine && *lpCmdLine > ' ')
-                                       lpCmdLine++;
-                       }
-
-                       if (*lpCmdLine)
-                       {
-                               *lpCmdLine = 0;
+               }
+               else
+               {
+                       // unquoted word
+                       argv[com_argc] = lpCmdLine;
+                       com_argc++;
+                       while (*lpCmdLine && *lpCmdLine > ' ')
                                lpCmdLine++;
-                       }
+               }
+
+               if (*lpCmdLine)
+               {
+                       *lpCmdLine = 0;
+                       lpCmdLine++;
                }
        }