aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2006-10-23 10:12:09 +0200
committerAnselm R. Garbe <arg@suckless.org>2006-10-23 10:12:09 +0200
commitf63327677421a07cca69b86c7dd5f01047fe14b1 (patch)
tree8c375884b50131eaf232924f66abde6287f81454
parentbb480fb4b0fd06207b2ee1b88eb32b8588e698dc (diff)
fixing arg handling in dmenu (thanks to Sander for his report)
-rw-r--r--config.mk2
-rw-r--r--main.c30
2 files changed, 19 insertions, 13 deletions
diff --git a/config.mk b/config.mk
index 63fbad3..e0be79f 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
1# dmenu version 1# dmenu version
2VERSION = 1.3 2VERSION = 1.4
3 3
4# Customize below to fit your system 4# Customize below to fit your system
5 5
diff --git a/main.c b/main.c
index 3fa1e54..1d37f70 100644
--- a/main.c
+++ b/main.c
@@ -286,18 +286,24 @@ main(int argc, char *argv[]) {
286 timeout.tv_sec = 3; 286 timeout.tv_sec = 3;
287 /* command line args */ 287 /* command line args */
288 for(i = 1; i < argc; i++) 288 for(i = 1; i < argc; i++)
289 if(!strncmp(argv[i], "-font", 6)) 289 if(!strncmp(argv[i], "-font", 6)) {
290 font = argv[++i]; 290 if(++i < argc) font = argv[i];
291 else if(!strncmp(argv[i], "-normbg", 8)) 291 }
292 normbg = argv[++i]; 292 else if(!strncmp(argv[i], "-normbg", 8)) {
293 else if(!strncmp(argv[i], "-normfg", 8)) 293 if(++i < argc) normbg = argv[i];
294 normfg = argv[++i]; 294 }
295 else if(!strncmp(argv[i], "-selbg", 7)) 295 else if(!strncmp(argv[i], "-normfg", 8)) {
296 selbg = argv[++i]; 296 if(++i < argc) normfg = argv[i];
297 else if(!strncmp(argv[i], "-selfg", 7)) 297 }
298 selfg = argv[++i]; 298 else if(!strncmp(argv[i], "-selbg", 7)) {
299 else if(!strncmp(argv[i], "-t", 3)) 299 if(++i < argc) selbg = argv[i];
300 timeout.tv_sec = atoi(argv[++i]); 300 }
301 else if(!strncmp(argv[i], "-selfg", 7)) {
302 if(++i < argc) selfg = argv[i];
303 }
304 else if(!strncmp(argv[i], "-t", 3)) {
305 if(++i < argc) timeout.tv_sec = atoi(argv[i]);
306 }
301 else if(!strncmp(argv[i], "-v", 3)) { 307 else if(!strncmp(argv[i], "-v", 3)) {
302 fputs("dmenu-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); 308 fputs("dmenu-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
303 exit(EXIT_SUCCESS); 309 exit(EXIT_SUCCESS);