From 3f1a49704f52380e066d0de655f9f16bdd931236 Mon Sep 17 00:00:00 2001 From: Bogomil Vasilev Date: Mon, 7 Jan 2019 01:10:22 +0200 Subject: [PATCH] identation and minor failure condition fix --- src/confparser.c | 1 + src/main.c | 53 ++++++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/confparser.c b/src/confparser.c index 8dcbfd1..b0693ee 100644 --- a/src/confparser.c +++ b/src/confparser.c @@ -430,6 +430,7 @@ static int test_conf_syntax(char *config) } else log(ERROR, "Unknown config entry on line %d: %s", j, buf); + failed = 1; if (!ok) { log(ERROR, "Invalid value for \"%s\", line %d: \"%s\"", diff --git a/src/main.c b/src/main.c index 1d58781..3409cc6 100644 --- a/src/main.c +++ b/src/main.c @@ -74,34 +74,35 @@ int main(int argc, char *argv[]) }; int opt = 0, opt_index = 0, fork_flag = 0; char *config = NULL; - while ((opt = getopt_long(argc, argv, opts_short, opts_long, &opt_index)) != -1) { + while ((opt = getopt_long(argc, argv, opts_short, opts_long, + &opt_index)) != -1) { switch (opt) { - case 0: - if (opts_long[opt_index].flag != 0) { - break; - } - log(INFO, "option %s", opts_long[opt_index].name); - if (optarg) - log(INFO, "with arg %s\n", optarg); + case 0: + if (opts_long[opt_index].flag != 0) { break; - case 'd': - fork_flag = 1; - break; - case 'c': - config = optarg; - break; - case 'h': - usage(argv[0]); - exit(EXIT_SUCCESS); - case 't': - task = TEST; - break; - case 'T': - task = TEST_AND_EXPORT; - break; - default: - usage(argv[0]); - exit(EXIT_FAILURE); + } + log(INFO, "option %s", opts_long[opt_index].name); + if (optarg) + log(INFO, "with arg %s\n", optarg); + break; + case 'd': + fork_flag = 1; + break; + case 'c': + config = optarg; + break; + case 'h': + usage(argv[0]); + exit(EXIT_SUCCESS); + case 't': + task = TEST; + break; + case 'T': + task = TEST_AND_EXPORT; + break; + default: + usage(argv[0]); + exit(EXIT_FAILURE); } }