Index: trunk/DNSDB/ExportBIND.pm
===================================================================
--- trunk/DNSDB/ExportBIND.pm	(revision 860)
+++ trunk/DNSDB/ExportBIND.pm	(revision 861)
@@ -249,4 +249,10 @@
   } # SOA
 
+  elsif ($typemap{$type} eq 'A') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+#    print $datafile "+$host:$val:$ttl:$stamp:$loc\n" or die $!;
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      A       $val\n" or die $!;
+  } # A
+
   elsif ($typemap{$type} eq 'NS') {
     if ($revrec eq 'y') {
@@ -258,5 +264,5 @@
 
 #      print {$zonefiles->{$loc}} "$zone       $ttl    IN      NS      $host\n";
-      print "$zone     $ttl    IN      NS      $host\n";
+      print "$zone     $ttl    IN      NS      $host\n" or die $!;
 
     } else {
@@ -265,4 +271,79 @@
   } # NS
 
+  elsif ($typemap{$type} eq 'AAAA') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+    my $altgrp = 0;
+    my @altconv;
+    # Split in to up to 8 groups of hex digits (allows for IPv6 :: 0-collapsing)
+    foreach (split /:/, $val) {
+      if (/^$/) {
+        # flag blank entry;  this is a series of 0's of (currently) unknown length
+        $altconv[$altgrp++] = 's';
+      } else {
+        # call sub to convert 1-4 hex digits to 2 string-rep octal bytes
+        $altconv[$altgrp++] = octalize($_)
+      }
+    }
+    my $prefix = ":$host:28:";
+    foreach my $octet (@altconv) {
+      # if not 's', output
+      $prefix .= $octet unless $octet =~ /^s$/;
+      # if 's', output (9-array length)x literal '\000\000'
+      $prefix .= '\000\000'x(9-$altgrp) if $octet =~ /^s$/;
+    }
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      AAAA    $val\n" or die $!;
+  } # AAAA
+
+  elsif ($typemap{$type} eq 'TXT') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      TXT     \"$val\"\n" or die $!;
+  } # TXT
+
+  elsif ($typemap{$type} eq 'CNAME') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      CNAME   $val\n" or die $!;
+  } # CNAME
+
+  elsif ($typemap{$type} eq 'SRV') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      SRV     $dist   $weight $port   $val\n" or die $!;
+  } # SRV
+
+  elsif ($typemap{$type} eq 'RP') {
+#    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
+    print {$zonefiles->{$loc}} "$host  $ttl    IN      RP      $val\n" or die $!;
+  } # RP
+
+
+  elsif ($typemap{$type} eq 'PTR') {
+#    $$recflags{$val}++;
+    if ($revrec eq 'y') {
+
+      if ($val =~ /\.arpa$/) {
+        # someone put in the formal .arpa name.  humor them.
+        print {$zonefiles->{$loc}} "^$val:$host:$ttl:$stamp:$loc\n" or die $!;
+      } else {
+        $zone = NetAddr::IP->new($zone);
+        if (!$zone->{isv6} && $zone->masklen > 24) {
+          # sub-octet v4 zone
+          ($val) = ($val =~ /\.(\d+)$/);
+          print {$zonefiles->{$loc}} "^$val."._ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
+            ":$host:$ttl:$stamp:$loc\n" or die $!;
+        } else {
+          # not going to care about strange results if $val is not an IP value and is resolveable in DNS
+          $val = NetAddr::IP->new($val);
+          print {$zonefiles->{$loc}} "^".
+            _ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
+            ":$host:$ttl:$stamp:$loc\n" or die $!;
+        }
+      } # non-".arpa" $val
+
+    } else {
+      # PTRs in forward zones are less bizarre and insane than some other record types
+      # in reverse zones...  OTOH we can't validate them any which way, so we cross our
+      # fingers and close our eyes and make it Someone Else's Problem.
+      print {$zonefiles->{$loc}} "^$host:$val:$ttl:$stamp:$loc\n" or die $!;
+    }
+  } # PTR
 
 } # printrec_bind()
