From 5eb658a51fbe8fdb4efdc9379f1bc5bffe86931c Mon Sep 17 00:00:00 2001 From: mathias Date: Tue, 24 Apr 2007 19:38:40 +0000 Subject: fixed a bug in parsing cli, thanks to steven kah hien wong --- ChangeLog | 4 ++++ src/main.cc | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a5dae0..ca435eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 1.0.0: +*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: * Use asciidoc-generated manpages as the default from now on (Mathias) * Disabled resizing shaded windows (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", "")<