From 507ef3c21d5dea525170569580a05b717d1f7d5c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 23 Mar 2008 21:35:34 +0100 Subject: [PATCH] Fix -c option, and make -k accept -c option better Signed-off-by: Julien Danjou --- awesome.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/awesome.c b/awesome.c index 3b4f81d18..f16a65817 100644 --- a/awesome.c +++ b/awesome.c @@ -177,7 +177,7 @@ main(int argc, char *argv[]) struct sockaddr_un *addr; Client *c; XSetWindowAttributes wa; - Bool xsync = False; + Bool xsync = False, confcheck = False; static struct option long_options[] = { {"help", 0, NULL, 'h'}, @@ -202,7 +202,7 @@ main(int argc, char *argv[]) } /* check args */ - while((opt = getopt_long(argc, argv, "vhkcs:", + while((opt = getopt_long(argc, argv, "vhkc:s", long_options, NULL)) != -1) switch(opt) { @@ -214,12 +214,12 @@ main(int argc, char *argv[]) break; case 'c': if(a_strlen(optarg)) - confpath = optarg; + confpath = a_strdup(optarg); else eprint("-c option requires a file name\n"); break; case 'k': - return config_check(confpath); + confcheck = True; break; case 's': xsync = True; @@ -229,6 +229,9 @@ main(int argc, char *argv[]) /* Text won't be printed correctly otherwise */ setlocale(LC_CTYPE, ""); + if(confcheck) + return config_check(confpath); + /* X stuff */ if(!(dpy = XOpenDisplay(NULL))) eprint("cannot open display\n");