notepad: Only skip valid command options.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2017-01-31 01:31:33 -02:00 committed by Alexandre Julliard
parent 57b83e1459
commit bd19402b6d
1 changed files with 14 additions and 7 deletions

View File

@ -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;
}
}
}