1
0
Fork 0
mbuni/mbuni/mmsbox/mmsbox.c

66 lines
1.4 KiB
C

/*
* Mbuni - Open Source MMS Gateway
*
* MMSBOX: MMS Content engine
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License, with a few exceptions granted (see LICENSE)
*/
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include "mmsbox_cfg.h"
static int rstop = 0;
static void quit_now(int notused)
{
rstop = 1;
/* Close all MMSC http ports, kill all MMSC threads, kill sendmms port... */
}
int main(int argc, char *argv[])
{
Octstr *fname;
int cfidx;
Cfg *cfg;
mms_lib_init();
srandom(time(NULL));
cfidx = get_and_set_debugs(argc, argv, NULL);
if (argv[cfidx] == NULL)
fname = octstr_imm("mbuni.conf");
else
fname = octstr_create(argv[cfidx]);
cfg = cfg_create(fname);
if (cfg_read(cfg) == -1)
panic(0, "Couldn't read configuration from '%s'.", octstr_get_cstr(fname));
octstr_destroy(fname);
info(0, "----------------------------------------");
info(0, " " MM_NAME " MMSBox version %s starting", MMSC_VERSION);
mms_load_mmsbox_settings(cfg,NULL);
cfg_destroy(cfg);
signal(SIGHUP, quit_now);
signal(SIGTERM, quit_now);
signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for nothing*/
return 0;
}