]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/arguments.cc
rec: ensure correct service user on debian
[thirdparty/pdns.git] / pdns / arguments.cc
index 2696ac3c8dea87b98ec6bdd6cfaa5d816ad1a278..1f2d04456a0c2609a38c26fdd84887594bcb88b8 100644 (file)
@@ -97,11 +97,10 @@ bool ArgvMap::contains(const string &var, const string &val)
     return false;
   }
   vector<string> parts;
-  vector<string>::const_iterator i;
   
   stringtok( parts, param->second, ", \t" );
-  for( i = parts.begin(); i != parts.end(); ++i ) {
-    if( *i == val ) {
+  for (const auto& part: parts) {
+    if (part == val) {
       return true;
     }
   }
@@ -115,30 +114,27 @@ string ArgvMap::helpstring(string prefix)
     prefix="";
   
   string help;
-  
-  for(map<string,string>::const_iterator i=helpmap.begin();
-      i!=helpmap.end();
-      ++i)
-    {
-      if(!prefix.empty() && i->first.find(prefix) != 0) // only print items with prefix
-        continue;
+
+  for (const auto& i: helpmap) {
+      if(!prefix.empty() && i.first.find(prefix) != 0) // only print items with prefix
+          continue;
 
       help+="  --";
-      help+=i->first;
+      help+=i.first;
       
-      string type=d_typeMap[i->first];
+      string type=d_typeMap[i.first];
 
       if(type=="Parameter")
         help+="=...";
       else if(type=="Switch")
         {
-          help+=" | --"+i->first+"=yes";
-          help+=" | --"+i->first+"=no";
+          help+=" | --"+i.first+"=yes";
+          help+=" | --"+i.first+"=no";
         }
       
 
       help+="\n\t";
-      help+=i->second;
+      help+=i.second;
       help+="\n";
 
     }
@@ -154,20 +150,20 @@ string ArgvMap::configstring(bool current)
   else
     help="# Autogenerated configuration file template\n";
   
-  for(map<string,string>::const_iterator i=helpmap.begin(); i!=helpmap.end(); ++i) {
-    if(d_typeMap[i->first]=="Command")
+  for(const auto& i: helpmap) {
+    if(d_typeMap[i.first]=="Command")
       continue;
 
     help+="#################################\n";
     help+="# ";
-    help+=i->first;
+    help+=i.first;
     help+="\t";
-    help+=i->second;
+    help+=i.second;
     help+="\n#\n";
     if (current) {
-      help+=i->first+"="+params[i->first]+"\n\n";
+      help+=i.first+"="+params[i.first]+"\n\n";
     } else {
-      help+="# "+i->first+"="+params[i->first]+"\n\n";
+      help+="# "+i.first+"="+params[i.first]+"\n\n";
     }
   }
   return help;