about summary refs log tree commit diff
path: root/main.c
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 /main.c
parentAdded tag 1.3 for changeset 2eb9997be51cb1b11a8900728ccc0904f9371157 (diff)
downloaddmenu-f63327677421a07cca69b86c7dd5f01047fe14b1.tar.gz
dmenu-f63327677421a07cca69b86c7dd5f01047fe14b1.tar.bz2
dmenu-f63327677421a07cca69b86c7dd5f01047fe14b1.zip
fixing arg handling in dmenu (thanks to Sander for his report)
Diffstat (limited to 'main.c')
-rw-r--r--main.c30
1 files changed, 18 insertions, 12 deletions
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[]) {
 	timeout.tv_sec = 3;
 	/* command line args */
 	for(i = 1; i < argc; i++)
-		if(!strncmp(argv[i], "-font", 6))
-			font = argv[++i];
-		else if(!strncmp(argv[i], "-normbg", 8))
-			normbg = argv[++i];
-		else if(!strncmp(argv[i], "-normfg", 8))
-			normfg = argv[++i];
-		else if(!strncmp(argv[i], "-selbg", 7))
-			selbg = argv[++i];
-		else if(!strncmp(argv[i], "-selfg", 7))
-			selfg = argv[++i];
-		else if(!strncmp(argv[i], "-t", 3))
-			timeout.tv_sec = atoi(argv[++i]);
+		if(!strncmp(argv[i], "-font", 6)) {
+			if(++i < argc) font = argv[i];
+		}
+		else if(!strncmp(argv[i], "-normbg", 8)) {
+			if(++i < argc) normbg = argv[i];
+		}
+		else if(!strncmp(argv[i], "-normfg", 8)) {
+			if(++i < argc) normfg = argv[i];
+		}
+		else if(!strncmp(argv[i], "-selbg", 7)) {
+			if(++i < argc) selbg = argv[i];
+		}
+		else if(!strncmp(argv[i], "-selfg", 7)) {
+			if(++i < argc) selfg = argv[i];
+		}
+		else if(!strncmp(argv[i], "-t", 3)) {
+			if(++i < argc) timeout.tv_sec = atoi(argv[i]);
+		}
 		else if(!strncmp(argv[i], "-v", 3)) {
 			fputs("dmenu-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
 			exit(EXIT_SUCCESS);