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) static void HandleCommandLine(LPWSTR cmdline)
{ {
WCHAR delimiter; WCHAR delimiter, *ptr;
BOOL opt_print = FALSE; BOOL opt_print = FALSE;
/* skip white space */ /* skip white space */
@ -630,24 +630,31 @@ static void HandleCommandLine(LPWSTR cmdline)
if (*cmdline == delimiter) cmdline++; if (*cmdline == delimiter) cmdline++;
while (*cmdline == ' ' || *cmdline == '-' || *cmdline == '/') ptr = cmdline;
while (*ptr == ' ' || *ptr == '-' || *ptr == '/')
{ {
WCHAR option; WCHAR option;
if (*cmdline++ == ' ') continue; if (*ptr++ == ' ') continue;
option = *cmdline; option = *ptr;
if (option) cmdline++; if (option) ptr++;
while (*cmdline == ' ') cmdline++; while (*ptr == ' ') ptr++;
switch(option) switch(option)
{ {
case 'p': case 'p':
case 'P': case 'P':
{
if (!opt_print)
{
opt_print = TRUE; opt_print = TRUE;
cmdline = ptr;
}
break; break;
} }
} }
}
if (*cmdline) if (*cmdline)
{ {