]> granicus.if.org Git - pdns/commitdiff
teach pdnssec about config-dir
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 4 Jan 2011 10:12:39 +0000 (10:12 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 4 Jan 2011 10:12:39 +0000 (10:12 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1802 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/pdnssec.cc

index 4752d7a02877cdb981153f88c4467fc5c8e9c37b..ab48297fd4c32871a4f8886deaabf27275ddc133 100644 (file)
@@ -33,11 +33,9 @@ string humanTime(time_t t)
   return ret;
 }
 
-void loadMainConfig()
+void loadMainConfig(const std::string& configdir)
 {
-   static char pietje[128]="!@@SYSCONFDIR@@:";
-  ::arg().set("config-dir","Location of configuration directory (pdns.conf)")=
-    strcmp(pietje+1,"@@SYSCONFDIR@@:") ? pietje+strlen("@@SYSCONFDIR@@:")+1 : SYSCONFDIR;
+  ::arg().set("config-dir","Location of configuration directory (pdns.conf)")=configdir;
   
   ::arg().set("launch","Which backends to launch");
   ::arg().set("dnssec","if we should do dnssec")="true";
@@ -132,7 +130,7 @@ void orderZone(DNSSECKeeper& dk, const std::string& zone)
 
 void checkZone(DNSSECKeeper& dk, const std::string& zone)
 {
-  loadMainConfig();
+  loadMainConfig(g_vm["config-dir"].as<string>());
   reportAllTypes();  
   UeberBackend* B = new UeberBackend("default");
   SOAData sd;
@@ -174,6 +172,7 @@ try
     ("help,h", "produce help message")
     ("verbose,v", po::value<bool>(), "be verbose")
     ("force", "force an action")
+    ("config-dir", po::value<string>()->default_value(SYSCONFDIR), "location of pdns.conf")
     ("commands", po::value<vector<string> >());
 
   po::positional_options_description p;
@@ -189,11 +188,12 @@ try
   if(cmds.empty() || g_vm.count("help")) {
     cerr<<"Usage: \npdnssec [options] [show-zone] [secure-zone] [alter-zone] [order-zone] [add-zone-key] [deactivate-zone-key] [remove-zone-key] [activate-zone-key]\n";
     cerr<<"         [import-zone-key] [export-zone-key] [set-nsec3] [unset-nsec3] [export-zone-dnskey]"<<endl;
+    cerr<<"Options:"<<endl;
     cerr<<desc<<endl;
     return 0;
   }
 
-  loadMainConfig();
+  loadMainConfig(g_vm["config-dir"].as<string>());
   reportAllTypes();
   DNSSECKeeper dk;