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;
xdgHandle xdg;
bool no_argb = false;
bool run_test = false;
xcb_generic_event_t *event;
xcb_query_tree_cookie_t tree_c;
static struct option long_options[] =
@ -340,16 +341,8 @@ main(int argc, char **argv)
exit_help(EXIT_SUCCESS);
break;
case 'k':
if(!luaA_parserc(&xdg, confpath, false))
{
fprintf(stderr, "✘ Configuration file syntax error.\n");
return EXIT_FAILURE;
}
else
{
fprintf(stderr, "✔ Configuration file syntax OK.\n");
return EXIT_SUCCESS;
}
run_test = true;
break;
case 'c':
if(a_strlen(optarg))
confpath = a_strdup(optarg);
@ -361,6 +354,20 @@ main(int argc, char **argv)
break;
}
if (run_test)
{
if(!luaA_parserc(&xdg, confpath, false))
{
fprintf(stderr, "✘ Configuration file syntax error.\n");
return EXIT_FAILURE;
}
else
{
fprintf(stderr, "✔ Configuration file syntax OK.\n");
return EXIT_SUCCESS;
}
}
/* register function for signals */
g_unix_signal_add(SIGINT, exit_on_signal, NULL);
g_unix_signal_add(SIGTERM, exit_on_signal, NULL);