summaryrefslogtreecommitdiff
path: root/src/anytun-controld.cpp
diff options
context:
space:
mode:
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();