summaryrefslogtreecommitdiff
path: root/src/anytun-controld.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-22 14:32:51 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-22 14:32:51 +0000
commit1501e7126a04f12363b3a03d19fe0e0bae91b598 (patch)
treeddb529e9168e6deced7dac6d6d1cf9f80ea09244 /src/anytun-controld.cpp
parentadded -L|--log to command line parser (diff)
added log target support to anytun-contorld and anytun-config
Diffstat (limited to 'src/anytun-controld.cpp')
-rw-r--r--src/anytun-controld.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/anytun-controld.cpp b/src/anytun-controld.cpp
index 2c6c619..372b0bb 100644
--- a/src/anytun-controld.cpp
+++ b/src/anytun-controld.cpp
@@ -97,26 +97,34 @@ int main(int argc, char* argv[])
bool daemonized=false;
try
{
- cLog.addTarget("syslog:7,anytun-controld,daemon");
- cLog.msg(Log::PRIO_NOTICE) << "anytun-controld started...";
-
try
{
bool result = gOpt.parse(argc, argv);
if(!result) {
- cLog.msg(Log::PRIO_NOTICE) << "printing help text and exitting";
gOpt.printUsage();
exit(0);
}
+ StringList targets = gOpt.getLogTargets();
+ if(targets.empty()) {
+ cLog.addTarget("syslog:7,anytun-controld,daemon");
+ }
+ else {
+ StringList::const_iterator it;
+ for(it = targets.begin();it != targets.end(); ++it)
+ cLog.addTarget(*it);
+ }
}
catch(syntax_error& e)
{
std::cerr << e << std::endl;
- cLog.msg(Log::PRIO_NOTICE) << "exitting after syntax error";
gOpt.printUsage();
exit(-1);
}
+ cLog.msg(Log::PRIO_NOTICE) << "anytun-controld started...";
+ gOpt.parse_post(); // print warnings
+
+
std::ifstream file( gOpt.getFileName().c_str() );
if( file.is_open() )
file.close();