diff options
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r-- | base/commandLine.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 5583eed30a..b273e50f81 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -1,6 +1,8 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2001 Ludvig Strigeus - * Copyright (C) 2001-2006 The ScummVM project +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -245,18 +247,17 @@ void registerDefaults() { } \ const char *option = s; \ if (*s == '\0' && !isLongCmd) { option = s2; i++; } \ - if (!option) option = defaultVal; \ + if (!option || *option == '\0') option = defaultVal; \ if (option) settings[longCmd] = option; // Use this for options which have a required (string) value #define DO_OPTION(shortCmd, longCmd) \ DO_OPTION_OPT(shortCmd, longCmd, 0) \ - if (!option) usage("Option '%s' requires an argument", argv[i-1]); + if (!option) usage("Option '%s' requires an argument", argv[isLongCmd ? i : i-1]); // Use this for options which have a required integer value #define DO_OPTION_INT(shortCmd, longCmd) \ - DO_OPTION_OPT(shortCmd, longCmd, 0) \ - if (!option) usage("Option '%s' requires an argument", argv[i-1]); \ + DO_OPTION(shortCmd, longCmd) \ char *endptr = 0; \ int intValue; intValue = (int)strtol(option, &endptr, 0); \ if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option); |