Moved some logic out of main into updater.
[bpdyndnsd] / src / main.cpp
CommitLineData
b1be615b
BS
1/** @file
2 * @brief The main function.
3 *
4 *
5 *
6 * @copyright Intra2net AG
7 * @license GPLv2
8*/
4545a371
BS
9
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
14#define VERSION 0
15#define REVISION 1
16#define RELEASE 0
17
18#include <iostream>
19#include <list>
20#include <string>
21
22#include <boost/foreach.hpp>
23
24#include "updater.cpp"
25#include "config.cpp"
26
27#include "service.cpp"
28
29#include "dhs.cpp"
30#include "ods.cpp"
31
32using namespace std;
33
85a0abf9
BS
34typedef boost::shared_ptr<Config> ConfigPtr;
35typedef boost::shared_ptr<Updater> UpdaterPtr;
36
4545a371 37/**
b1be615b
BS
38 * @brief The main part.
39 * @param argc Number of arguments
40 * @param argv Command line arguments
41 * @return 0 if all is fine.
4545a371
BS
42 */
43int main(int argc, char *argv[])
44{
38060291 45 // initialize Config
85a0abf9 46 ConfigPtr config(new Config);
4545a371 47
38060291
BS
48 // initialize Updater
49 UpdaterPtr updater(new Updater(config));
50
51 if ( updater->init_config_from_cmd(argc,argv) != 0 )
1cf4e2b5 52 return 0;
38060291
BS
53
54 if ( updater->init_config_from_files() != 0 )
98bd3874 55 return 0;
4545a371 56
4545a371
BS
57 updater->update_services();
58
4545a371
BS
59 return 0;
60}