Hi, I&#39;ve been playing with zone2sql a lot lately, and I&#39;m trying<br>to mess with 1000s of old zonefiles and convert them from bind to<br>powerdns.<br>&nbsp;&nbsp; &nbsp;<br>I do not have control over the older zonefiles, so everytime I was doing
<br>some test conversions, I had to deal with all the lowercase &quot;ns&quot;, &quot;a&quot;,<br>&quot;soa&quot; and convert them with perl pies, and that meant copying all of them<br>first.&nbsp; In other words, it was a hassle.
<br>&nbsp;&nbsp; &nbsp;<br>Is this something that you all can change so that it can deal with<br>lowercase types?&nbsp; it takes a lot of the sting out of converting<br>zonefiles for me.&nbsp; So I thought I would ask.<br>&nbsp;&nbsp; &nbsp;<br>I added a quick patch with a tiny functor to deal with this directly in
<br>QType::chartocode, qtype.cc&nbsp; It&#39;s only a few lines, and you all might<br>want it in a different style, but the functionality is all I&#39;m looking<br>for.&nbsp; <br><br>--- qtype.orig&nbsp; 2007-04-26 14:08:52.000000000 -0500
<br>+++ qtype.cc&nbsp;&nbsp;&nbsp; 2007-04-26 14:08:43.000000000 -0500<br>@@ -85,12 +85,27 @@<br>&nbsp;&nbsp; return *this;<br>&nbsp;}<br>&nbsp;<br>+<br>+// Functor for calling std::toupper.<br>+// <br>+struct ToUpper {<br>+&nbsp; int operator() ( int c )<br>+&nbsp; {
<br>+&nbsp;&nbsp;&nbsp; return std::toupper ( c );<br>+&nbsp; }<br>+};<br>+<br>&nbsp;int QType::chartocode(const char *p)<br>&nbsp;{<br>+<br>+&nbsp; std::string codestr(p);<br>+&nbsp; std::transform(codestr.begin(), codestr.end(), codestr.begin(), ToUpper());<br>
+<br>&nbsp;&nbsp; static QType qt;<br>&nbsp;&nbsp; vector&lt;namenum&gt;::iterator pos;<br>&nbsp;&nbsp; for(pos=names.begin();pos&lt;names.end();++pos)<br>-&nbsp;&nbsp;&nbsp; if(pos-&gt;first==p)<br>+&nbsp;&nbsp;&nbsp; if(pos-&gt;first==codestr.c_str()) // Do compare with converted string
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return pos-&gt;second;<br>&nbsp;<br>&nbsp;&nbsp; return 0;<br><br>=======================================<br><br>I&#39;m not sure of any ill effects this could have, but chartocode is<br>only called from 8 or 9 places in pdns, and it&#39;s not updating any
<br>input, so it seems pretty safe, but you all will know better than<br>I.<br>Also, I&#39;m aware that you all might have built this functionality into<br>another part of the code, and you could add that behavior much more
<br>elegantly, but I just wanted to submit a prototype to see if it&#39;s<br>something that you are all interested in or if I should just keep<br>it for myself own use.<br><br>Thanks,<br><br>Pete<br><br><br>