honor appended -c option for --check

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
kardan 2013-06-12 14:15:54 +02:00 committed by Uli Schlachter
parent 0c62831eea
commit 57bec371f7
1 changed files with 17 additions and 10 deletions

View File

@ -288,6 +288,7 @@ main(int argc, char **argv)
ssize_t cmdlen = 1; ssize_t cmdlen = 1;
xdgHandle xdg; xdgHandle xdg;
bool no_argb = false; bool no_argb = false;
bool run_test = false;
xcb_generic_event_t *event; xcb_generic_event_t *event;
xcb_query_tree_cookie_t tree_c; xcb_query_tree_cookie_t tree_c;
static struct option long_options[] = static struct option long_options[] =
@ -340,6 +341,21 @@ main(int argc, char **argv)
exit_help(EXIT_SUCCESS); exit_help(EXIT_SUCCESS);
break; break;
case 'k': case 'k':
run_test = true;
break;
case 'c':
if(a_strlen(optarg))
confpath = a_strdup(optarg);
else
fatal("-c option requires a file name");
break;
case 'a':
no_argb = true;
break;
}
if (run_test)
{
if(!luaA_parserc(&xdg, confpath, false)) if(!luaA_parserc(&xdg, confpath, false))
{ {
fprintf(stderr, "✘ Configuration file syntax error.\n"); fprintf(stderr, "✘ Configuration file syntax error.\n");
@ -350,15 +366,6 @@ main(int argc, char **argv)
fprintf(stderr, "✔ Configuration file syntax OK.\n"); fprintf(stderr, "✔ Configuration file syntax OK.\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
case 'c':
if(a_strlen(optarg))
confpath = a_strdup(optarg);
else
fatal("-c option requires a file name");
break;
case 'a':
no_argb = true;
break;
} }
/* register function for signals */ /* register function for signals */