aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authormathias <mathias>2007-04-24 19:38:40 (GMT)
committermathias <mathias>2007-04-24 19:38:40 (GMT)
commit5eb658a51fbe8fdb4efdc9379f1bc5bffe86931c (patch)
treefc06d5dcb75f5ec707e7926287ebb5c2f3722a5f /src/main.cc
parent35605d9c778b4b8aa8aaa39c059ea958dc0f196b (diff)
downloadfluxbox-5eb658a51fbe8fdb4efdc9379f1bc5bffe86931c.zip
fluxbox-5eb658a51fbe8fdb4efdc9379f1bc5bffe86931c.tar.bz2
fixed a bug in parsing cli, thanks to steven kah hien wong <steven at zensaki dot com>
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc11
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
182int main(int argc, char **argv) { 182int 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