From 57bec371f70f121785cd062dca3b86f18fd685fd Mon Sep 17 00:00:00 2001 From: kardan Date: Wed, 12 Jun 2013 14:15:54 +0200 Subject: [PATCH] honor appended -c option for --check Signed-off-by: Uli Schlachter --- awesome.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/awesome.c b/awesome.c index 4755d1c4..01bd9696 100644 --- a/awesome.c +++ b/awesome.c @@ -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);