diff options
author | markt <markt> | 2007-04-27 22:19:48 (GMT) |
---|---|---|
committer | markt <markt> | 2007-04-27 22:19:48 (GMT) |
commit | f342b1758abe89b8e02905d9f31e9b766973d122 (patch) | |
tree | dd56f536b3c59ac64dedf245f1cd25129c512a0c /src | |
parent | 6848e180a69cf55840f337f2ca3e70db44f25fd5 (diff) | |
download | fluxbox-f342b1758abe89b8e02905d9f31e9b766973d122.zip fluxbox-f342b1758abe89b8e02905d9f31e9b766973d122.tar.bz2 |
bug in command line parsing
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc index 7b98597..643c6a4 100644 --- a/src/main.cc +++ b/src/main.cc | |||
@@ -181,7 +181,7 @@ static void showInfo(ostream &ostr) { | |||
181 | 181 | ||
182 | int main(int argc, char **argv) { | 182 | int main(int argc, char **argv) { |
183 | 183 | ||
184 | string session_display = ""; | 184 | string session_display(""); |
185 | string rc_file; | 185 | string rc_file; |
186 | string log_filename; | 186 | string log_filename; |
187 | 187 | ||
@@ -200,7 +200,7 @@ int main(int argc, char **argv) { | |||
200 | exit(EXIT_FAILURE); | 200 | exit(EXIT_FAILURE); |
201 | } | 201 | } |
202 | 202 | ||
203 | rc_file = arg; | 203 | rc_file = argv[i]; |
204 | } else if (arg == "-display") { | 204 | } else if (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 |
@@ -212,7 +212,7 @@ int main(int argc, char **argv) { | |||
212 | exit(EXIT_FAILURE); | 212 | exit(EXIT_FAILURE); |
213 | } | 213 | } |
214 | 214 | ||
215 | session_display = arg; | 215 | session_display = argv[i]; |
216 | string display_env = "DISPLAY=" + session_display; | 216 | string display_env = "DISPLAY=" + session_display; |
217 | if (putenv(const_cast<char *>(display_env.c_str()))) { | 217 | if (putenv(const_cast<char *>(display_env.c_str()))) { |
218 | cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv, | 218 | cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv, |
@@ -225,11 +225,11 @@ int main(int argc, char **argv) { | |||
225 | cout << "Fluxbox " << __fluxbox_version << " : (c) 2001-2007 Henrik Kinnunen " << endl << endl; | 225 | cout << "Fluxbox " << __fluxbox_version << " : (c) 2001-2007 Henrik Kinnunen " << endl << endl; |
226 | exit(EXIT_SUCCESS); | 226 | exit(EXIT_SUCCESS); |
227 | } else if (arg == "-log") { | 227 | } else if (arg == "-log") { |
228 | if (i + 1 >= 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 == "-help" || arg == "-h") { | 233 | } else if (arg == "-help" || arg == "-h") { |
234 | // print program usage and command line options | 234 | // print program usage and command line options |
235 | printf(_FB_CONSOLETEXT(main, Usage, | 235 | printf(_FB_CONSOLETEXT(main, Usage, |
@@ -338,3 +338,4 @@ int main(int argc, char **argv) { | |||
338 | 338 | ||
339 | return exitcode; | 339 | return exitcode; |
340 | } | 340 | } |
341 | |||