From 36c4bc7aee504a7d76471ca7bf5a0a49ed314e26 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 26 May 2008 01:35:53 +0200 Subject: [PATCH] Make --loglevel and --S work. --- adu.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/adu.c b/adu.c index 1aaea35..f8096fb 100644 --- a/adu.c +++ b/adu.c @@ -48,7 +48,7 @@ __printf_2_3 void __log(int ll, const char* fmt,...) time_t t1; char str[255] = ""; - if (ll < 4) + if (ll < conf.loglevel_arg) return; outfd = stderr; time(&t1); @@ -750,7 +750,7 @@ static void close_all_tables(void) free_hash_table(); } -static int com_create(char *dirname) +static int com_create() { int ret = create_tables(); if (ret < 0) @@ -758,7 +758,7 @@ static int com_create(char *dirname) ret = open_dir_table(); if (ret < 0) return ret; - ret = scan_dir(dirname); + ret = scan_dir(conf.base_dir_arg); if (ret < 0) goto out; ret = write_uid_list(); @@ -810,7 +810,7 @@ static int com_select(void) int main(int argc, char **argv) { - int ret = -E_SYNTAX; + int ret; struct cmdline_parser_params params = { .override = 0, .initialize = 1, @@ -820,12 +820,11 @@ int main(int argc, char **argv) }; cmdline_parser_ext(argc, argv, &conf, ¶ms); /* aborts on errors */ - if (argc > 2) - goto out; - if (argc == 1) + ret = -E_SYNTAX; + if (conf.select_given) ret = com_select(); else - ret = com_create(argv[1]); + ret = com_create(); if (ret < 0) goto out; out: -- 2.39.5