X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famtrmlog.c;h=6b4e0eadbd1aca28321ce25eaab81492704d6dff;hb=e676d2a937a46194f0bd97a130ae1a4138e8b4e9;hp=8bce5df0bc95f954e9fe42b360d3eb985ee3083a;hpb=e442edb4d5816c4ad107ad9e71164f845eba70ad;p=debian%2Famanda diff --git a/server-src/amtrmlog.c b/server-src/amtrmlog.c index 8bce5df..6b4e0ea 100644 --- a/server-src/amtrmlog.c +++ b/server-src/amtrmlog.c @@ -37,7 +37,6 @@ #include "diskfile.h" #include "tapefile.h" #include "find.h" -#include "version.h" int amtrmidx_debug = 0; @@ -65,7 +64,12 @@ main( char *conf_tapelist; char *conf_logdir; int dumpcycle; - config_overwrites_t *cfg_ovr = NULL; + config_overrides_t *cfg_ovr = NULL; + + if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) { + printf("amtrmlog-%s\n", VERSION); + return (0); + } /* * Configure program for internationalization: @@ -84,12 +88,12 @@ main( /* Don't die when child closes pipe */ signal(SIGPIPE, SIG_IGN); - cfg_ovr = extract_commandline_config_overwrites(&argc, &argv); + cfg_ovr = extract_commandline_config_overrides(&argc, &argv); if (argc > 1 && strcmp(argv[1], "-t") == 0) { amtrmidx_debug = 1; - my_argc--; - my_argv++; + argc--; + argv++; } if (argc < 2) { @@ -98,23 +102,26 @@ main( } dbopen(DBG_SUBDIR_SERVER); - dbprintf(_("%s: version %s\n"), argv[0], version()); + dbprintf(_("%s: version %s\n"), argv[0], VERSION); - config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL, - argv[1]); - apply_config_overwrites(cfg_ovr); - - check_running_as(RUNNING_AS_DUMPUSER); - - dbrename(config_name, DBG_SUBDIR_SERVER); + set_config_overrides(cfg_ovr); + config_init(CONFIG_INIT_EXPLICIT_NAME, argv[1]); conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE)); - if (read_diskfile(conf_diskfile, &diskl) < 0) { - error(_("could not load disklist \"%s\""), conf_diskfile); - /*NOTREACHED*/ - } + read_diskfile(conf_diskfile, &diskl); amfree(conf_diskfile); + if (config_errors(NULL) >= CFGERR_WARNINGS) { + config_print_errors(); + if (config_errors(NULL) >= CFGERR_ERRORS) { + g_critical(_("errors processing config file")); + } + } + + check_running_as(RUNNING_AS_DUMPUSER); + + dbrename(get_config_name(), DBG_SUBDIR_SERVER); + conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST)); if (read_tapelist(conf_tapelist)) { error(_("could not load tapelist \"%s\""), conf_tapelist);