Fix -c option, and make -k accept -c option better

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-23 21:35:34 +01:00
parent be12562ab7
commit 507ef3c21d
1 changed files with 7 additions and 4 deletions

View File

@ -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");