Commit bd19402b authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

notepad: Only skip valid command options.

parent 57b83e14
......@@ -615,7 +615,7 @@ static int AlertFileDoesNotExist(LPCWSTR szFileName)
static void HandleCommandLine(LPWSTR cmdline)
{
WCHAR delimiter;
WCHAR delimiter, *ptr;
BOOL opt_print = FALSE;
/* skip white space */
......@@ -630,22 +630,29 @@ static void HandleCommandLine(LPWSTR cmdline)
if (*cmdline == delimiter) cmdline++;
while (*cmdline == ' ' || *cmdline == '-' || *cmdline == '/')
ptr = cmdline;
while (*ptr == ' ' || *ptr == '-' || *ptr == '/')
{
WCHAR option;
if (*cmdline++ == ' ') continue;
if (*ptr++ == ' ') continue;
option = *cmdline;
if (option) cmdline++;
while (*cmdline == ' ') cmdline++;
option = *ptr;
if (option) ptr++;
while (*ptr == ' ') ptr++;
switch(option)
{
case 'p':
case 'P':
opt_print = TRUE;
{
if (!opt_print)
{
opt_print = TRUE;
cmdline = ptr;
}
break;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment