From df8fe0ebc356a8a3d919bb4ff9f2a0bd859d6f58 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Sat, 6 Mar 2010 18:39:39 +0100 Subject: Update with vng version; Fix command line parser reporting wrong options --- src/CommandLineParser.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/CommandLineParser.cpp b/src/CommandLineParser.cpp index 62f0f39..7e7658a 100644 --- a/src/CommandLineParser.cpp +++ b/src/CommandLineParser.cpp @@ -198,7 +198,7 @@ void CommandLineParser::Private::parse() bool optionsAllowed = true; ParsedOption option; OptionDefinition currentDefinition; - for(int i = 1; i < argumentCount; i++) { + for (int i = 1; i < argumentCount; i++) { QString arg = QString::fromLocal8Bit(argumentStrings[i]); if (optionsAllowed) { if (arg == QLatin1String("--")) { @@ -214,9 +214,11 @@ void CommandLineParser::Private::parse() continue; } if (arg[0].unicode() == '-' && arg.length() > 1) { - for(int x = 1; x < arg.length(); x++) { + for (int x = 1; x < arg.length(); x++) { + bool resolved = false; foreach (OptionDefinition definition, definitions) { if (definition.shortName == arg[x]) { + resolved = true; processor.next(option); currentDefinition = definition; option.option = definition.name; @@ -228,7 +230,7 @@ void CommandLineParser::Private::parse() break; } } - if (option.option.isEmpty()) { // nothing found; copy char so it ends up in unrecognized + if (!resolved) { // nothing found; copy char so it ends up in unrecognized option.option = arg[x]; processor.next(option); } -- cgit v1.2.1