diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/utils/command.cc | 29 |
2 files changed, 24 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7198506f..9f2b546e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-06-05 Gabriel Dos Reis <gdr@ce.tamu.edu> + + * utils/command.cc (default_driver): New. + (preprocess_arguments): Use it. Honor --no-gui on Windows. + (OPENAXIOM_DEFAULT_DRIVER): Remove. + 2011-06-04 Gabriel Dos Reis <gdr@cs.tamu.edu> * driver/main.cc (upgrade_environment): Augment PATH for Windows diff --git a/src/utils/command.cc b/src/utils/command.cc index 498e2f4e..f53e6f70 100644 --- a/src/utils/command.cc +++ b/src/utils/command.cc @@ -249,13 +249,15 @@ build_rts_options(Command* command, Driver driver) } } -#if OPENAXIOM_USE_SMAN -# define OPENAXIOM_DEFAULT_DRIVER sman_driver -#elif OPENAXIOM_USE_GUI -# define OPENAXIOM_DEFAULT_DRIVER gui_driver -#else -# define OPENAXIOM_DEFAULT_DRIVER core_driver -#endif +// Return a description of the driver to invokve by default. +static Driver default_driver(bool explicit_no_gui) { + if (OPENAXIOM_USE_SMAN) + return sman_driver; + else if (OPENAXIOM_USE_GUI and not explicit_no_gui) + return gui_driver; + else + return core_driver; +} static void print_line(const char* line) { @@ -338,6 +340,7 @@ preprocess_arguments(Command* command, int argc, char** argv) int other = 1; int files = 0; Driver driver = unknown_driver; + bool explicit_no_gui = false; // True if --no-gui explicitly specified. command->root_dir = get_systemdir(argc, argv); for (i = 1; i < argc; ++i) @@ -370,9 +373,13 @@ preprocess_arguments(Command* command, int argc, char** argv) if (const Driver d = option_driver(argv[i])) driver = d; else { - if (argv[i][0] == '-') - /* Maybe option for the driver. */ - ; + /* Maybe option for the driver. */ + if (argv[i][0] == '-') { + // this is awkward to handle here since it supposed + // to go to Superman. FIXME when sman is gone. + if (strcmp(argv[i], "--no-gui") == 0) + explicit_no_gui = true; + } else if (strlen(argv[i]) > 0) /* Assume a file. */ ++files; @@ -416,7 +423,7 @@ preprocess_arguments(Command* command, int argc, char** argv) break; } else if (driver == unknown_driver) - driver = OPENAXIOM_DEFAULT_DRIVER; + driver = default_driver(explicit_no_gui); command->core.argv[command->core.argc] = NULL; build_rts_options(command, driver); |