From f342b1758abe89b8e02905d9f31e9b766973d122 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 27 Apr 2007 22:19:48 +0000 Subject: bug in command line parsing --- ChangeLog | 4 ++++ src/main.cc | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ed3b5d..cad8eaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1: +*07/04/24: + * Fixed a bug in parsing cli (Mathias, thanks to Steven Kah Hien Wong for pointing out the issue) + src/main.cc *07/04/23: * Set IconicState on all unmapped clients and unmap clients with frames, as per ICCCM 4.1.4 (Mark) 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) { int main(int argc, char **argv) { - string session_display = ""; + string session_display(""); string rc_file; string log_filename; @@ -200,7 +200,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - rc_file = arg; + rc_file = argv[i]; } else if (arg == "-display") { // check for -display option... to run on a display other than the one // set by the environment variable DISPLAY @@ -212,7 +212,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - session_display = arg; + session_display = argv[i]; string display_env = "DISPLAY=" + session_display; if (putenv(const_cast(display_env.c_str()))) { cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv, @@ -225,11 +225,11 @@ int main(int argc, char **argv) { cout << "Fluxbox " << __fluxbox_version << " : (c) 2001-2007 Henrik Kinnunen " << endl << endl; exit(EXIT_SUCCESS); } else if (arg == "-log") { - if (i + 1 >= argc) { + if (++i >= argc) { cerr<<_FB_CONSOLETEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<