]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Added new configstring() method that returns the current configuration.
authorRuben d'Arco <cyclops@prof-x.net>
Mon, 30 Apr 2012 06:13:15 +0000 (08:13 +0200)
committerRuben d'Arco <cyclops@prof-x.net>
Tue, 7 May 2013 20:28:31 +0000 (22:28 +0200)
pdns/arguments.cc [changed mode: 0644->0755]
pdns/arguments.hh [changed mode: 0644->0755]
pdns/dynhandler.cc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index b9f2fec..585ae1e
@@ -129,11 +129,15 @@ string ArgvMap::helpstring(string prefix)
   return help;
 }
 
-string ArgvMap::configstring()
+string ArgvMap::configstring(bool current)
 {
   string help;
+
+  if (current)
+    help="# Autogenerated configuration file based on running instance\n";
+  else
+    help="# Autogenerated configuration file template\n";
   
-  help="# Autogenerated configuration file template\n";
   for(map<string,string>::const_iterator i=helpmap.begin();
       i!=helpmap.end();
       i++)
@@ -147,8 +151,11 @@ string ArgvMap::configstring()
       help+="\t";
       help+=i->second;
       help+="\n#\n";
-      help+="# "+i->first+"="+params[i->first]+"\n\n";
-
+      if (current) {
+        help+=i->first+"="+params[i->first]+"\n\n";
+      } else {
+        help+="# "+i->first+"="+params[i->first]+"\n\n";
+      }
     }
   return help;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 9f196a6..86fc07f
@@ -104,7 +104,7 @@ public:
   void setCmd(const string &, const string &); //!< Add a command flag
   string &setSwitch(const string &, const string &); //!< Add a command flag
   string helpstring(string prefix=""); //!< generates the --help
-  string configstring(); //!< generates the --mkconfig
+  string configstring(bool current=false); //!< generates the --mkconfig
   bool contains(const string &var, const string &val);
   bool isEmpty(const string &var); //<! checks if variable has value
 
old mode 100644 (file)
new mode 100755 (executable)