=================================================================== RCS file: /cvs/cvs/blind/blind.c,v retrieving revision 1.17 retrieving revision 1.23 diff -u -p -r1.17 -r1.23 --- blind/blind.c 2022/03/22 02:15:51 1.17 +++ blind/blind.c 2022/04/19 02:40:16 1.23 @@ -16,9 +16,9 @@ #include #include -#include #include #include +#include #include "blind.h" #include "config.h" @@ -26,7 +26,6 @@ static void usage(void); -int daemonize = 1; struct blind *bl; static void @@ -44,6 +43,7 @@ main(int argc, char *argv[]) int ch; int verbose = 0; int no_action = 0; + int daemonize = 1; const char *config = BL_CONF; while ((ch = getopt(argc, argv, "dhnvf:")) != -1) { @@ -57,6 +57,7 @@ main(int argc, char *argv[]) break; case 'n': no_action = 1; + daemonize = 0; break; case 'f': config = optarg; @@ -82,7 +83,7 @@ main(int argc, char *argv[]) if (verbose) { bl->bl_opt |= verbose; - log_setv(verbose); + log_set(verbose); log_debug("verbose mode on"); } @@ -90,17 +91,23 @@ main(int argc, char *argv[]) log_fatal("file name exceeds PATH_MAX"); if (config_load(bl)) - log_fatal("config %s", bl->bl_conf); + log_fatal("%s", bl->bl_conf); + if (no_action) { + // check config + log_info("configuration ok"); + free(bl); + exit(0); + } + log_debug("conf=%s", bl->bl_conf); log_debug("sock=%s", bl->bl_sock); log_debug(" ttl=%d", bl->bl_ttl); log_debug(" opt=%d", bl->bl_opt); - log_debug(" flg=%d", bl->bl_flg); - // TAILQ_INIT(&offline_queue) + // to be continued - // fork + process setup + communication setup + free(bl); exit(0); }