diff options
Diffstat (limited to 'src/calloutd.c')
-rw-r--r-- | src/calloutd.c | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/src/calloutd.c b/src/calloutd.c index b5c2d56b..4ad4103f 100644 --- a/src/calloutd.c +++ b/src/calloutd.c @@ -29,8 +29,7 @@ #include <sysexits.h> #include <mailutils/mailutils.h> -#include <mailutils/libcfg.h> -#include <mailutils/libargp.h> +#include <mailutils/cli.h> #include <mailutils/daemon.h> #include "libmf.h" @@ -45,33 +44,9 @@ callout_alloc_die() mu_error(_("not enough memory")); abort(); } - - -static void -version(FILE *stream, struct argp_state *state) -{ - mailfromd_version("calloutd", stream); -} - const char *program_version = "calloutd (" PACKAGE_STRING ")"; -static char doc[] = N_("calloutd -- a call out server"); -static char args_doc[] = ""; - -static struct argp_option options[] = { - { NULL } -}; - -static error_t -parse_opt(int key, char *arg, struct argp_state *state) -{ - switch (key) { - default: - return ARGP_ERR_UNKNOWN; - } - return 0; -} - +static char prog_doc[] = N_("calloutd -- a call out server"); struct mu_cfg_param callout_cfg_param[] = { { ".mfd:server", mu_cfg_section, NULL, 0, NULL, NULL }, @@ -90,24 +65,13 @@ struct mu_cfg_param callout_cfg_param[] = { extern char **environ; -static const char *capa[] = { - "common", +static char *capa[] = { "debug", "logging", "locking", + ".mfd:server", NULL }; - -static struct argp argp = { - options, - parse_opt, - args_doc, - doc, - NULL, - NULL, - NULL -}; - int mf_server_function(const char *key, struct mf_srvcfg *cfg) @@ -116,7 +80,12 @@ mf_server_function(const char *key, struct mf_srvcfg *cfg) return 0; } -extern char *program_invocation_short_name;//FIXME +static char const calloutd_config_file[] = SYSCONFDIR "/calloutd.conf"; + +struct mu_cli_setup cli = { + .cfg = callout_cfg_param, + .prog_doc = prog_doc, +}; int main(int argc, char **argv) @@ -126,9 +95,6 @@ main(int argc, char **argv) mf_init_nls(); mf_proctitle_init(argc, argv, environ); mu_alloc_die_hook = callout_alloc_die; - if (!program_invocation_short_name) - program_invocation_short_name = argv[0]; - argp_program_version_hook = version; /* Set default logging */ mu_log_facility = DEFAULT_LOG_FACILITY; mu_stdstream_setup(MU_STDSTREAM_RESET_NONE); @@ -140,18 +106,11 @@ main(int argc, char **argv) mf_server_save_cmdline(argc, argv); dnsbase_init(); database_cfg_init(); - mf_init_lock_options(); mu_acl_cfg_init(); srvman_init(); mf_srvcfg_init(argv[0], NULL); + mf_getopt(&cli, &argc, &argv, capa, 0, calloutd_config_file); - mu_argp_init(program_version, "<" PACKAGE_BUGREPORT ">"); - mu_site_rcfile = SYSCONFDIR "/calloutd.conf"; - rc = mu_app_init(&argp, capa, callout_cfg_param, argc, argv, - 0, NULL, NULL); - if (rc) - exit(EX_CONFIG); - mf_optcache_flush(); mf_srvcfg_flush(); mf_server_lint_option = "--config-lint"; |