From aee9889a27f97c8116fd4472cd3374b74e868bb6 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sat, 4 Oct 2008 14:32:20 -0700 Subject: [PATCH] recognize --option in addition to -option for most things --- ChangeLog | 4 +++- src/main.cc | 18 +++++++++--------- util/fbrun/main.cc | 21 +++++++++++---------- util/fbsetroot.cc | 23 +++++++++++------------ 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index d62889df..bdf3e728 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,11 @@ (Format: Year/Month/Day) Changes for 1.1.2 *08/10/04: + * Recognize --option in addition to -option for long option names (Mark) + main.cc util/fbsetroot.cc util/fbrun/main.cc * Add -print option to fbrun that sends the result to stdout instead of running it (Mark) - util/FbRun/main.cc FbRun.cc/hh + util/fbrun/main.cc FbRun.cc/hh * Fix CustomMenu and ClientMenu commands from fluxbox-remote (Mark) Screen.cc * Break emacs-style keychains after one invalid key has been pressed (Mark) diff --git a/src/main.cc b/src/main.cc index d69ce2d9..1cca774b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -191,7 +191,7 @@ int main(int argc, char **argv) { int i; for (i = 1; i < argc; ++i) { string arg(argv[i]); - if (arg == "-rc") { + if (arg == "-rc" || arg == "--rc") { // look for alternative rc file to use if ((++i) >= argc) { @@ -201,7 +201,7 @@ int main(int argc, char **argv) { } rc_file = argv[i]; - } else if (arg == "-display") { + } else if (arg == "-display" || arg == "--display") { // check for -display option... to run on a display other than the one // set by the environment variable DISPLAY @@ -220,19 +220,19 @@ int main(int argc, char **argv) { "")<= argc) { cerr<<_FB_CONSOLETEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<::CreatorMap cmap = FbTk::CommandParser::instance().creatorMap(); FbTk::CommandParser::CreatorMap::const_iterator it = cmap.begin(); const FbTk::CommandParser::CreatorMap::const_iterator it_end = cmap.end(); for (; it != it_end; ++it) cout << it->first << endl; exit(EXIT_SUCCESS); - } else if (arg == "-verbose") { + } else if (arg == "-verbose" || arg == "--verbose") { FbTk::ThemeManager::instance().setVerbose(true); } } diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc index f9875d3d..0bb8456e 100644 --- a/util/fbrun/main.cc +++ b/util/fbrun/main.cc @@ -86,27 +86,28 @@ int main(int argc, char **argv) { string history_file("~/.fluxbox/fbrun_history"); // command history file // parse arguments for (int i=1; i= argc) usage(1); fore = argv[i]; - } else if ((! strcmp("-bg", argv[i])) || - (! strcmp("-background", argv[i])) || - (! strcmp("-to", argv[i]))) { + } else if (arg == "-bg" || arg == "-background" || + arg == "--background" || arg == "-to" || arg == "--to") { if ((++i) >= argc) usage(1); back = argv[i]; - } else if (! strcmp("-solid", argv[i])) { + } else if (arg == "-solid" || arg == "--solid") { if ((++i) >= argc) usage(1); fore = argv[i]; sol = true; - } else if (! strcmp("-mod", argv[i])) { + } else if (arg == "-mod" || arg == "--mod") { if ((++i) >= argc) usage(); mod_x = atoi(argv[i]); @@ -103,14 +102,14 @@ fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) mod_y = 1; mod = true; - } else if (! strcmp("-gradient", argv[i])) { + } else if (arg == "-gradient" || arg == "--gradient") { if ((++i) >= argc) usage(); grad = argv[i]; grd = true; - } else if (! strcmp("-display", argv[i])) { + } else if (arg == "-display" || arg == "--display") { // -display passed through tests earlier... we just skip it now i++; @@ -382,7 +381,7 @@ int main(int argc, char **argv) { FbTk::NLSInit("fluxbox.cat"); for (; i < argc; i++) { - if (! strcmp(argv[i], "-display")) { + if (!strcmp(argv[i], "-display") || !strcmp(argv[i], "--display")) { // check for -display option if ((++i) >= argc) {