From 7cbd3c0f47524198ee25f417fba5acb0c690da44 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Sat, 11 Jun 2011 16:11:31 +1000 Subject: Fixed several bugs related to 'common' arguments. --- heimdall/source/InterfaceManager.cpp | 49 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'heimdall/source') diff --git a/heimdall/source/InterfaceManager.cpp b/heimdall/source/InterfaceManager.cpp index 107342b..26ef028 100644 --- a/heimdall/source/InterfaceManager.cpp +++ b/heimdall/source/InterfaceManager.cpp @@ -56,12 +56,12 @@ string InterfaceManager::dumpArgumentNames[kDumpArgCount * 2] = { string InterfaceManager::commonArgumentNames[kCommonArgCount * 2] = { // --- Long Names --- - "-verbose", "-no-reboot" + "-verbose", "-no-reboot", "-delay", // --- Short Names --- - "v", "nobt" + "v", "nobt", "d" }; @@ -216,34 +216,37 @@ bool InterfaceManager::GetArguments(int argc, char **argv, map& continue; } - // Check if the argument is a valid regular argument - for (int i = actionValuelessArgumentCount; i < actionArgumentCount; i++) + if (argumentNames != nullptr) { - // Support for -- and - parameters. - if (argumentName.length() > 1 && argumentNames[i].compare("-%d") == 0) + // Check if the argument is a valid regular argument + for (int i = actionValuelessArgumentCount; i < actionArgumentCount; i++) { - if (atoi(argumentName.substr(1).c_str()) > 0 || argumentName.compare("-0") == 0) + // Support for -- and - parameters. + if (argumentName.length() > 1 && argumentNames[i].compare("-%d") == 0) { - valid = true; - break; + if (atoi(argumentName.substr(1).c_str()) > 0 || argumentName.compare("-0") == 0) + { + valid = true; + break; + } } - } - else if (argumentNames[i].compare("%d") == 0) - { - if (atoi(argumentName.c_str()) > 0 || argumentName.compare("0") == 0) + else if (argumentNames[i].compare("%d") == 0) + { + if (atoi(argumentName.c_str()) > 0 || argumentName.compare("0") == 0) + { + argumentName = "-" + argumentName; + valid = true; + break; + } + } + + if (argumentName == argumentNames[i] || argumentName == argumentNames[actionArgumentCount + i]) { - argumentName = "-" + argumentName; + argumentName = argumentNames[i]; valid = true; break; } } - - if (argumentName == argumentNames[i] || argumentName == argumentNames[actionArgumentCount + i]) - { - argumentName = argumentNames[i]; - valid = true; - break; - } } if (!valid) @@ -252,7 +255,7 @@ bool InterfaceManager::GetArguments(int argc, char **argv, map& for (int i = commonValuelessArgumentCount; i < commonArgumentCount; i++) { // Support for -- and - parameters. - if (argumentName.length() > 1 && argumentNames[i].compare("-%d")) + if (argumentName.length() > 1 && commonArgumentNames[i].compare("-%d")) { if (atoi(argumentName.substr(1).c_str()) > 0 || argumentName.compare("-0") == 0) { @@ -260,7 +263,7 @@ bool InterfaceManager::GetArguments(int argc, char **argv, map& break; } } - else if (argumentNames[i].compare("%d")) + else if (commonArgumentNames[i].compare("%d")) { if (atoi(argumentName.c_str()) > 0 || argumentName.compare("0") == 0) { -- cgit v1.2.3