From 2cf1925eb46624eb8d025aa16a6d4d049b25aea9 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 26 Apr 2008 13:33:24 +0200 Subject: [PATCH] wordpad: Open the filename passed on command line if any. --- programs/wordpad/wordpad.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index b03ae2ed2e2..cec080ca7c8 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -1041,23 +1041,26 @@ static void HandleCommandLine(LPWSTR cmdline) while (*cmdline && *cmdline != delimiter) cmdline++; if (*cmdline == delimiter) cmdline++; - while (*cmdline == ' ' || *cmdline == '-' || *cmdline == '/') + while (*cmdline) { - WCHAR option; + while (isspace(*cmdline)) cmdline++; - if (*cmdline++ == ' ') continue; - - option = *cmdline; - if (option) cmdline++; - while (*cmdline == ' ') cmdline++; - - switch (option) + if (*cmdline == '-' || *cmdline == '/') { - case 'p': - case 'P': - opt_print = 1; - break; + if (!cmdline[2] || isspace(cmdline[2])) + { + switch (cmdline[1]) + { + case 'P': + case 'p': + opt_print = 1; + cmdline += 2; + continue; + } + } + /* a filename starting by / */ } + break; } if (*cmdline)