Newer
Older
//
// sld.cc for sld in /home/seblu
//
// Made by Seblu
// Login <seblu@epita.fr>
//
// Started on Fri Jun 1 02:09:43 2007 Seblu
// Last update Fri Jun 1 02:10:49 2007 Seblu
//
SLDaemon &daemon = SLDaemon::Instance();
SLDaemon::Options *lineopt;
SLDaemon::Options *fileopt = NULL;
try {
//parse arg line options
lineopt = daemon.getoptions(argc, argv);
assert(lineopt);
if (lineopt->conffile != "") {
//parse conf file options
fileopt = daemon.getoptions(lineopt->conffile);
}
}
catch (const Error &e) {
e.print();
return e.code();
}
try {
//apply config file option
if (fileopt)
daemon.applyoptions(fileopt);
// register sigchild handler
if (signal(SIGCHLD, sigchild) == SIG_ERR) {
perror("sld: error");
return ERR_UNKNOWN;
}
//execute receive command
daemon.run();
}
catch (const Error &e) {
std::cerr <<"sld: error: " << e.message() << std::endl;
return e.code();
}