diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 21:32:20 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-10-04 21:32:20 (GMT) |
commit | aee9889a27f97c8116fd4472cd3374b74e868bb6 (patch) | |
tree | 4762671c40b1570fb248ac9ff9cbf835845071f3 | |
parent | e6570b61f34e9d7822f500706a5a2cd6bc436234 (diff) | |
download | fluxbox-aee9889a27f97c8116fd4472cd3374b74e868bb6.zip fluxbox-aee9889a27f97c8116fd4472cd3374b74e868bb6.tar.bz2 |
recognize --option in addition to -option for most things
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/main.cc | 18 | ||||
-rw-r--r-- | util/fbrun/main.cc | 21 | ||||
-rw-r--r-- | util/fbsetroot.cc | 23 |
4 files changed, 34 insertions, 32 deletions
@@ -1,9 +1,11 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.1.2 | 2 | Changes for 1.1.2 |
3 | *08/10/04: | 3 | *08/10/04: |
4 | * Recognize --option in addition to -option for long option names (Mark) | ||
5 | main.cc util/fbsetroot.cc util/fbrun/main.cc | ||
4 | * Add -print option to fbrun that sends the result to stdout instead of | 6 | * Add -print option to fbrun that sends the result to stdout instead of |
5 | running it (Mark) | 7 | running it (Mark) |
6 | util/FbRun/main.cc FbRun.cc/hh | 8 | util/fbrun/main.cc FbRun.cc/hh |
7 | * Fix CustomMenu and ClientMenu commands from fluxbox-remote (Mark) | 9 | * Fix CustomMenu and ClientMenu commands from fluxbox-remote (Mark) |
8 | Screen.cc | 10 | Screen.cc |
9 | * Break emacs-style keychains after one invalid key has been pressed (Mark) | 11 | * Break emacs-style keychains after one invalid key has been pressed (Mark) |
diff --git a/src/main.cc b/src/main.cc index d69ce2d..1cca774 100644 --- a/src/main.cc +++ b/src/main.cc | |||
@@ -191,7 +191,7 @@ int main(int argc, char **argv) { | |||
191 | int i; | 191 | int i; |
192 | for (i = 1; i < argc; ++i) { | 192 | for (i = 1; i < argc; ++i) { |
193 | string arg(argv[i]); | 193 | string arg(argv[i]); |
194 | if (arg == "-rc") { | 194 | if (arg == "-rc" || arg == "--rc") { |
195 | // look for alternative rc file to use | 195 | // look for alternative rc file to use |
196 | 196 | ||
197 | if ((++i) >= argc) { | 197 | if ((++i) >= argc) { |
@@ -201,7 +201,7 @@ int main(int argc, char **argv) { | |||
201 | } | 201 | } |
202 | 202 | ||
203 | rc_file = argv[i]; | 203 | rc_file = argv[i]; |
204 | } else if (arg == "-display") { | 204 | } else if (arg == "-display" || arg == "--display") { |
205 | // check for -display option... to run on a display other than the one | 205 | // check for -display option... to run on a display other than the one |
206 | // set by the environment variable DISPLAY | 206 | // set by the environment variable DISPLAY |
207 | 207 | ||
@@ -220,19 +220,19 @@ int main(int argc, char **argv) { | |||
220 | "")<<endl; | 220 | "")<<endl; |
221 | perror("putenv()"); | 221 | perror("putenv()"); |
222 | } | 222 | } |
223 | } else if (arg == "-version" || arg == "-v") { | 223 | } else if (arg == "-version" || arg == "-v" || arg == "--version") { |
224 | // print current version string | 224 | // print current version string |
225 | cout << "Fluxbox " << __fluxbox_version << " : (c) 2001-2008 Fluxbox Team " << endl << endl; | 225 | cout << "Fluxbox " << __fluxbox_version << " : (c) 2001-2008 Fluxbox Team " << endl << endl; |
226 | exit(EXIT_SUCCESS); | 226 | exit(EXIT_SUCCESS); |
227 | } else if (arg == "-log") { | 227 | } else if (arg == "-log" || arg == "--log") { |
228 | if (++i >= argc) { | 228 | if (++i >= argc) { |
229 | cerr<<_FB_CONSOLETEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<<endl; | 229 | cerr<<_FB_CONSOLETEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<<endl; |
230 | exit(EXIT_FAILURE); | 230 | exit(EXIT_FAILURE); |
231 | } | 231 | } |
232 | log_filename = argv[i]; | 232 | log_filename = argv[i]; |
233 | } else if (arg == "-sync") { | 233 | } else if (arg == "-sync" || arg == "--sync") { |
234 | xsync = true; | 234 | xsync = true; |
235 | } else if (arg == "-help" || arg == "-h") { | 235 | } else if (arg == "-help" || arg == "-h" || arg == "--help") { |
236 | // print program usage and command line options | 236 | // print program usage and command line options |
237 | printf(_FB_CONSOLETEXT(main, Usage, | 237 | printf(_FB_CONSOLETEXT(main, Usage, |
238 | "Fluxbox %s : (c) %s Henrik Kinnunen\n" | 238 | "Fluxbox %s : (c) %s Henrik Kinnunen\n" |
@@ -250,17 +250,17 @@ int main(int argc, char **argv) { | |||
250 | "Main usage string. Please lay it out nicely. There is one %s that is given the version").c_str(), | 250 | "Main usage string. Please lay it out nicely. There is one %s that is given the version").c_str(), |
251 | __fluxbox_version, "2001-2008"); | 251 | __fluxbox_version, "2001-2008"); |
252 | exit(EXIT_SUCCESS); | 252 | exit(EXIT_SUCCESS); |
253 | } else if (arg == "-info" || arg == "-i") { | 253 | } else if (arg == "-info" || arg == "-i" || arg == "--info") { |
254 | showInfo(cout); | 254 | showInfo(cout); |
255 | exit(EXIT_SUCCESS); | 255 | exit(EXIT_SUCCESS); |
256 | } else if (arg == "-list-commands") { | 256 | } else if (arg == "-list-commands" || arg == "--list-commands") { |
257 | FbTk::CommandParser<void>::CreatorMap cmap = FbTk::CommandParser<void>::instance().creatorMap(); | 257 | FbTk::CommandParser<void>::CreatorMap cmap = FbTk::CommandParser<void>::instance().creatorMap(); |
258 | FbTk::CommandParser<void>::CreatorMap::const_iterator it = cmap.begin(); | 258 | FbTk::CommandParser<void>::CreatorMap::const_iterator it = cmap.begin(); |
259 | const FbTk::CommandParser<void>::CreatorMap::const_iterator it_end = cmap.end(); | 259 | const FbTk::CommandParser<void>::CreatorMap::const_iterator it_end = cmap.end(); |
260 | for (; it != it_end; ++it) | 260 | for (; it != it_end; ++it) |
261 | cout << it->first << endl; | 261 | cout << it->first << endl; |
262 | exit(EXIT_SUCCESS); | 262 | exit(EXIT_SUCCESS); |
263 | } else if (arg == "-verbose") { | 263 | } else if (arg == "-verbose" || arg == "--verbose") { |
264 | FbTk::ThemeManager::instance().setVerbose(true); | 264 | FbTk::ThemeManager::instance().setVerbose(true); |
265 | } | 265 | } |
266 | } | 266 | } |
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc index f9875d3..0bb8456 100644 --- a/util/fbrun/main.cc +++ b/util/fbrun/main.cc | |||
@@ -86,27 +86,28 @@ int main(int argc, char **argv) { | |||
86 | string history_file("~/.fluxbox/fbrun_history"); // command history file | 86 | string history_file("~/.fluxbox/fbrun_history"); // command history file |
87 | // parse arguments | 87 | // parse arguments |
88 | for (int i=1; i<argc; i++) { | 88 | for (int i=1; i<argc; i++) { |
89 | if (strcmp(argv[i], "-font") == 0 && i+1 < argc) { | 89 | string arg = argv[i]; |
90 | if ((arg == "-font" || arg == "--font") && i+1 < argc) { | ||
90 | fontname = argv[++i]; | 91 | fontname = argv[++i]; |
91 | } else if (strcmp(argv[i], "-print") == 0) { | 92 | } else if (arg == "-print" || arg == "--print") { |
92 | print = true; | 93 | print = true; |
93 | } else if (strcmp(argv[i], "-title") == 0 && i+1 < argc) { | 94 | } else if ((arg == "-title" || arg == "--title") && i+1 < argc) { |
94 | title = argv[++i]; | 95 | title = argv[++i]; |
95 | } else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) { | 96 | } else if ((arg == "-text" || arg == "--text") && i+1 < argc) { |
96 | text = argv[++i]; | 97 | text = argv[++i]; |
97 | } else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) { | 98 | } else if (arg == "-w" && i+1 < argc) { |
98 | width = atoi(argv[++i]); | 99 | width = atoi(argv[++i]); |
99 | set_width = true; | 100 | set_width = true; |
100 | } else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) { | 101 | } else if (arg == "-h" && i+1 < argc) { |
101 | height = atoi(argv[++i]); | 102 | height = atoi(argv[++i]); |
102 | set_height = true; // mark true else the height of font will be used | 103 | set_height = true; // mark true else the height of font will be used |
103 | } else if (strcmp(argv[i], "-display") == 0 && i+1 < argc) { | 104 | } else if ((arg == "-display" || arg == "--display") && i+1 < argc) { |
104 | display_name = argv[++i]; | 105 | display_name = argv[++i]; |
105 | } else if (strcmp(argv[i], "-pos") == 0 && i+2 < argc) { | 106 | } else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) { |
106 | x = atoi(argv[++i]); | 107 | x = atoi(argv[++i]); |
107 | y = atoi(argv[++i]); | 108 | y = atoi(argv[++i]); |
108 | set_pos = true; | 109 | set_pos = true; |
109 | } else if (strcmp(argv[i], "-nearmouse") == 0) { | 110 | } else if (arg == "-nearmouse" || arg == "--nearmouse") { |
110 | set_pos = true; | 111 | set_pos = true; |
111 | near_mouse = true; | 112 | near_mouse = true; |
112 | } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) { | 113 | } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) { |
@@ -117,7 +118,7 @@ int main(int argc, char **argv) { | |||
117 | antialias = false; | 118 | antialias = false; |
118 | } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) { | 119 | } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) { |
119 | history_file = argv[++i]; | 120 | history_file = argv[++i]; |
120 | } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { | 121 | } else if (arg == "-h" || arg == "-help" || arg == "--help") { |
121 | showUsage(argv[0]); | 122 | showUsage(argv[0]); |
122 | exit(0); | 123 | exit(0); |
123 | } else { | 124 | } else { |
diff --git a/util/fbsetroot.cc b/util/fbsetroot.cc index 2312e37..cb55e16 100644 --- a/util/fbsetroot.cc +++ b/util/fbsetroot.cc | |||
@@ -67,30 +67,29 @@ fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) | |||
67 | img_ctrl = new FbTk::ImageControl(screen); | 67 | img_ctrl = new FbTk::ImageControl(screen); |
68 | 68 | ||
69 | for (; i < argc; i++) { | 69 | for (; i < argc; i++) { |
70 | if (! strcmp("-help", argv[i])) { | 70 | string arg = argv[i]; |
71 | if (arg == "-help" || arg == "--help" || arg == "-h") { | ||
71 | usage(); | 72 | usage(); |
72 | 73 | ||
73 | } else if ((! strcmp("-fg", argv[i])) || | 74 | } else if (arg == "-fg" || arg == "-foreground" || |
74 | (! strcmp("-foreground", argv[i])) || | 75 | arg == "--foreground" || arg == "-from" || arg == "--from") { |
75 | (! strcmp("-from", argv[i]))) { | ||
76 | if ((++i) >= argc) | 76 | if ((++i) >= argc) |
77 | usage(1); | 77 | usage(1); |
78 | fore = argv[i]; | 78 | fore = argv[i]; |
79 | 79 | ||
80 | } else if ((! strcmp("-bg", argv[i])) || | 80 | } else if (arg == "-bg" || arg == "-background" || |
81 | (! strcmp("-background", argv[i])) || | 81 | arg == "--background" || arg == "-to" || arg == "--to") { |
82 | (! strcmp("-to", argv[i]))) { | ||
83 | if ((++i) >= argc) | 82 | if ((++i) >= argc) |
84 | usage(1); | 83 | usage(1); |
85 | back = argv[i]; | 84 | back = argv[i]; |
86 | 85 | ||
87 | } else if (! strcmp("-solid", argv[i])) { | 86 | } else if (arg == "-solid" || arg == "--solid") { |
88 | if ((++i) >= argc) | 87 | if ((++i) >= argc) |
89 | usage(1); | 88 | usage(1); |
90 | fore = argv[i]; | 89 | fore = argv[i]; |
91 | sol = true; | 90 | sol = true; |
92 | 91 | ||
93 | } else if (! strcmp("-mod", argv[i])) { | 92 | } else if (arg == "-mod" || arg == "--mod") { |
94 | if ((++i) >= argc) | 93 | if ((++i) >= argc) |
95 | usage(); | 94 | usage(); |
96 | mod_x = atoi(argv[i]); | 95 | mod_x = atoi(argv[i]); |
@@ -103,14 +102,14 @@ fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) | |||
103 | mod_y = 1; | 102 | mod_y = 1; |
104 | mod = true; | 103 | mod = true; |
105 | 104 | ||
106 | } else if (! strcmp("-gradient", argv[i])) { | 105 | } else if (arg == "-gradient" || arg == "--gradient") { |
107 | if ((++i) >= argc) | 106 | if ((++i) >= argc) |
108 | usage(); | 107 | usage(); |
109 | 108 | ||
110 | grad = argv[i]; | 109 | grad = argv[i]; |
111 | grd = true; | 110 | grd = true; |
112 | 111 | ||
113 | } else if (! strcmp("-display", argv[i])) { | 112 | } else if (arg == "-display" || arg == "--display") { |
114 | // -display passed through tests earlier... we just skip it now | 113 | // -display passed through tests earlier... we just skip it now |
115 | i++; | 114 | i++; |
116 | 115 | ||
@@ -382,7 +381,7 @@ int main(int argc, char **argv) { | |||
382 | FbTk::NLSInit("fluxbox.cat"); | 381 | FbTk::NLSInit("fluxbox.cat"); |
383 | 382 | ||
384 | for (; i < argc; i++) { | 383 | for (; i < argc; i++) { |
385 | if (! strcmp(argv[i], "-display")) { | 384 | if (!strcmp(argv[i], "-display") || !strcmp(argv[i], "--display")) { |
386 | // check for -display option | 385 | // check for -display option |
387 | 386 | ||
388 | if ((++i) >= argc) { | 387 | if ((++i) >= argc) { |