diff options
author | Torbjörn Andersson | 2006-07-22 15:16:28 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-07-22 15:16:28 +0000 |
commit | e3ab20ee90cfe1c823a01a545cc0944433e4ad7a (patch) | |
tree | 5927b6db024d4d92e3e95c3a6738e0e46d23f22c /base | |
parent | 3f817264378f72a7c04ff570a91f7aac3ba67837 (diff) | |
download | scummvm-rg350-e3ab20ee90cfe1c823a01a545cc0944433e4ad7a.tar.gz scummvm-rg350-e3ab20ee90cfe1c823a01a545cc0944433e4ad7a.tar.bz2 scummvm-rg350-e3ab20ee90cfe1c823a01a545cc0944433e4ad7a.zip |
Fixed DO_OPTION_OPT so that the '=' is no longer required in long options. (The
value is, as the name implies, optional.) This fixes bug #1526483.
svn-id: r23561
Diffstat (limited to 'base')
-rw-r--r-- | base/commandLine.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 70f06031a7..8372b976fb 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -261,12 +261,15 @@ void registerDefaults() { // Use this for options which have an *optional* value #define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \ - if (isLongCmd ? (!memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \ + if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \ s += 2; \ - if (isLongCmd) \ - s += sizeof(longCmd"=") - 1; \ + if (isLongCmd) { \ + s += sizeof(longCmd) - 1; \ + if (*s == '=') \ + s++; \ + } \ const char *option = s; \ - if (*s == '\0') { option = s2; i++; } \ + if (*s == '\0' && !isLongCmd) { option = s2; i++; } \ if (!option) option = defaultVal; \ if (option) settings[longCmd] = option; |