From e37df10732317d158951ff11932eeb8f8e7f1214 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 11 Sep 2004 00:45:46 +0000 Subject: [PATCH] another attempt to fix quoted strings in windows commandline, but more so a cleanup git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4469 d7cf8633-e32d-0410-b094-e92efae38249 --- sys_win.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sys_win.c b/sys_win.c index 8dd82998..e261d04d 100644 --- 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++; } } -- 2.39.2