aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-11-13 12:45:35 +0000
committerMax Horn2008-11-13 12:45:35 +0000
commit4e51c62e3978e451beb03c6e7c221a0709851e45 (patch)
tree76ad5857086682e175aa4b5ceed53f71d4e717a5
parent04a33b48c073a34eaa66dbf9e92e9ad04ab1ff26 (diff)
downloadscummvm-rg350-4e51c62e3978e451beb03c6e7c221a0709851e45.tar.gz
scummvm-rg350-4e51c62e3978e451beb03c6e7c221a0709851e45.tar.bz2
scummvm-rg350-4e51c62e3978e451beb03c6e7c221a0709851e45.zip
Added DISABLE_COMMAND_LINE switch
svn-id: r35045
-rw-r--r--base/commandLine.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 415e57d8d6..6d1d7b3c8d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -38,6 +38,8 @@
namespace Base {
+#ifndef DISABLE_COMMAND_LINE
+
static const char USAGE_STRING[] =
"%s: %s\n"
"Usage: %s [OPTIONS]... [GAME]\n"
@@ -139,6 +141,9 @@ static void usage(const char *s, ...) {
exit(1);
}
+#endif // DISABLE_COMMAND_LINE
+
+
void registerDefaults() {
// Graphics
@@ -205,6 +210,8 @@ void registerDefaults() {
// Various macros used by the command line parser.
//
+#ifndef DISABLE_COMMAND_LINE
+
// Use this for options which have an *optional* value
#define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
@@ -513,8 +520,7 @@ unknownOption:
}
}
-
- return Common::String::emptyString;
+ return Common::String();
}
/** List all supported game IDs, i.e. all games which any loaded plugin supports. */
@@ -677,8 +683,21 @@ static void runDetectorTest() {
}
#endif
+#else // DISABLE_COMMAND_LINE
+
+
+Common::String parseCommandLine(Common::StringMap &settings, int argc, char **argv) {
+ return Common::String();
+}
+
+
+#endif // DISABLE_COMMAND_LINE
+
+
bool processSettings(Common::String &command, Common::StringMap &settings) {
+#ifndef DISABLE_COMMAND_LINE
+
// Handle commands passed via the command line (like --list-targets and
// --list-games). This must be done after the config file and the plugins
// have been loaded.
@@ -706,6 +725,8 @@ bool processSettings(Common::String &command, Common::StringMap &settings) {
}
#endif
+#endif // DISABLE_COMMAND_LINE
+
// If a target was specified, check whether there is either a game
// domain (i.e. a target) matching this argument, or alternatively
@@ -731,7 +752,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings) {
ConfMan.set("id_came_from_command_line", "1");
} else {
+#ifndef DISABLE_COMMAND_LINE
usage("Unrecognized game target '%s'", command.c_str());
+#endif // DISABLE_COMMAND_LINE
}
}