From 3f581f06110d597c5be6197676c1c0a9c658b36c Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Fri, 18 Mar 2016 18:12:01 +1000 Subject: [PATCH] * add option -t: config test --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index c25b9a5..2ca101a 100644 --- a/src/main.c +++ b/src/main.c @@ -113,6 +113,7 @@ update_opts_from_config(f2b_config_section_t *section) { } int main(int argc, char *argv[]) { + bool config_test = true; struct sigaction act; f2b_config_t config; f2b_config_section_t *section = NULL; @@ -120,7 +121,7 @@ int main(int argc, char *argv[]) { f2b_jail_t *jail = NULL; char opt = '\0'; - while ((opt = getopt(argc, argv, "c:dh")) != -1) { + while ((opt = getopt(argc, argv, "c:dht")) != -1) { switch (opt) { case 'c': strlcpy(opts.config_path, optarg, sizeof(opts.config_path)); @@ -131,6 +132,8 @@ int main(int argc, char *argv[]) { case 'h': usage(EXIT_SUCCESS); break; + case 't': + break; default: usage(EXIT_FAILURE); break; @@ -148,6 +151,10 @@ int main(int argc, char *argv[]) { f2b_log_msg(log_error, "can't load config from '%s'", opts.config_path); return EXIT_FAILURE; } + if (config_test) { + fprintf(stderr, "config test ok"); + exit(EXIT_SUCCESS); + } update_opts_from_config(config.main); if (opts.daemon) {