Commit 21c85efd authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Also recognize '/' as the start of an option.

Implement 'notepad /p'. Simplify many string parsing loops.
parent 8fa7ee26
...@@ -199,14 +199,13 @@ static int AlertFileDoesNotExist(LPCWSTR szFileName) ...@@ -199,14 +199,13 @@ static int AlertFileDoesNotExist(LPCWSTR szFileName)
static void HandleCommandLine(LPWSTR cmdline) static void HandleCommandLine(LPWSTR cmdline)
{ {
WCHAR delimiter; WCHAR delimiter;
int opt_print=0;
/* skip white space */ /* skip white space */
while (*cmdline && *cmdline == ' ') cmdline++; while (*cmdline == ' ') cmdline++;
/* skip executable name */ /* skip executable name */
delimiter = ' '; delimiter = (*cmdline == '"' ? '"' : ' ');
if (*cmdline == '"')
delimiter = '"';
do do
{ {
...@@ -215,7 +214,7 @@ static void HandleCommandLine(LPWSTR cmdline) ...@@ -215,7 +214,7 @@ static void HandleCommandLine(LPWSTR cmdline)
while (*cmdline && *cmdline != delimiter); while (*cmdline && *cmdline != delimiter);
if (*cmdline == delimiter) cmdline++; if (*cmdline == delimiter) cmdline++;
while (*cmdline && (*cmdline == ' ' || *cmdline == '-')) while (*cmdline == ' ' || *cmdline == '-' || *cmdline == '/')
{ {
WCHAR option; WCHAR option;
...@@ -223,14 +222,14 @@ static void HandleCommandLine(LPWSTR cmdline) ...@@ -223,14 +222,14 @@ static void HandleCommandLine(LPWSTR cmdline)
option = *cmdline; option = *cmdline;
if (option) cmdline++; if (option) cmdline++;
while (*cmdline && *cmdline == ' ') cmdline++; while (*cmdline == ' ') cmdline++;
switch(option) switch(option)
{ {
case 'p': case 'p':
case 'P': printf("Print file: "); case 'P':
/* TODO - not yet able to print a file */ opt_print=1;
break; break;
} }
} }
...@@ -275,6 +274,8 @@ static void HandleCommandLine(LPWSTR cmdline) ...@@ -275,6 +274,8 @@ static void HandleCommandLine(LPWSTR cmdline)
{ {
DoOpenFile(file_name); DoOpenFile(file_name);
InvalidateRect(Globals.hMainWnd, NULL, FALSE); InvalidateRect(Globals.hMainWnd, NULL, FALSE);
if (opt_print)
DIALOG_FilePrint();
} }
else else
{ {
......
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