From: Ruben d'Arco Date: Mon, 30 Apr 2012 06:13:15 +0000 (+0200) Subject: Added new configstring() method that returns the current configuration. X-Git-Tag: rec-3.6.0-rc1~550^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6bef3d91f88c475ed828e415eaadf1228d9c6f87;p=thirdparty%2Fpdns.git Added new configstring() method that returns the current configuration. --- diff --git a/pdns/arguments.cc b/pdns/arguments.cc old mode 100644 new mode 100755 index b9f2fece43..585ae1e87b --- a/pdns/arguments.cc +++ b/pdns/arguments.cc @@ -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::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; } diff --git a/pdns/arguments.hh b/pdns/arguments.hh old mode 100644 new mode 100755 index 9f196a686a..86fc07fb95 --- a/pdns/arguments.hh +++ b/pdns/arguments.hh @@ -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); //