Back to index

natlog  0.91.0
main.cc
Go to the documentation of this file.
00001 #include "main.ih"
00002 
00003 // Room for Args initialization
00004 namespace   // the anonymous namespace can be used here
00005 {
00006     Arg::LongOption longOptions[] =
00007     {
00008         Arg::LongOption("config", 'c'),
00009         Arg::LongOption("conntrack-path", Arg::Required),
00010         Arg::LongOption("no-daemon", Arg::None),
00011         Arg::LongOption("help", 'h'),
00012         Arg::LongOption("no-syslog", Arg::None),
00013         Arg::LongOption("stdout", 's'),
00014         Arg::LongOption("pid-file", 'p'),
00015         Arg::LongOption("syslog-tag", Arg::Required),
00016         Arg::LongOption("syslog-facility", Arg::Required),
00017         Arg::LongOption("syslog-priority", Arg::Required),
00018         Arg::LongOption("time", 't'),
00019         Arg::LongOption("verbose", Arg::None),
00020         Arg::LongOption("version", 'v'),
00021         Arg::LongOption("warn", 'w'),
00022     };
00023 
00024     auto longEnd = longOptions + sizeof(longOptions) / sizeof(longOptions[0]);
00025 }
00026 
00027 
00028 int main(int argc, char **argv)
00029 try
00030 {
00031     ArgConfig &arg = ArgConfig::initialize("c:hp:st:vw", 
00032                         longOptions, longEnd, argc, argv);
00033     
00034     arg.versionHelp(usage, Icmbuild::version, 1);
00035 
00036     NatFork fork;
00037 
00038     fork.run();
00039 }
00040 catch (Errno const &err)
00041 {
00042     cout << err.why() << endl;
00043     return 1;
00044 }
00045 catch (Options::ExitStatus status)
00046 {
00047     return status;
00048 }