/* This file is part of Mailfromd.
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Sergey
Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
#ifdef HAVE_CONFIG_H
# include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "libmf.h"
#include "callout.h"
#include "srvman.h"
#include "srvcfg.h"
#include "mfdb.h"
#include "mf-dbm.h"
void
xalloc_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;
}
struct mu_cfg_param callout_cfg_param[] = {
{ ".pm:server", mu_cfg_section, NULL, 0, NULL, NULL },
{ NULL }
};
extern char **environ;
static const char *capa[] = {
"common",
"debug",
"logging",
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)
{
cfg->server = callout_session_server;
return 0;
}
int
main(int argc, char **argv)
{
int rc;
mf_init_nls();
mf_proctitle_init(argc, argv, environ);
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;
mf_srvcfg_log_setup(stderr_closed_p() ? "syslog" : "stderr");
libcallout_init();
libdbm_init();
db_format_setup();
mf_server_save_cmdline(argc, argv);
dnsbase_init();
database_cfg_init();
mu_acl_cfg_init();
srvman_init();
mf_srvcfg_init(argv[0], NULL);
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_srvcfg_flush();
mf_server_start("calloutd", mailfromd_state_dir, pidfile,
server_flags);
exit(0);
}