Index: trunk/bind-import
===================================================================
--- trunk/bind-import	(revision 815)
+++ trunk/bind-import	(revision 816)
@@ -40,4 +40,5 @@
 
 ##fixme:  this is wrong, BIND zone files are generally complete and we're adding.  merging records is an entire fridge full of worms.
+##fixme:  for import, should arguably check for zone *non*existence
 if ($zname =~ /\.arpa\.?$/ || $zname =~ m,^[\d./]+$,) {
   $rev = 'y';
@@ -74,5 +75,6 @@
   next if /^\s*$/;
   next if /^\s*;/;	# comments
-  next if /^\s*\)/;	# SOA closing.  arguably should do some more targeted voodoo when parsing the SOA details
+  next if /^\s*\)/;	# SOA closing (possibly other records too?)
+			# arguably should do some more targeted voodoo when parsing the SOA details
 
 print "($_)\n";
@@ -184,36 +186,47 @@
 my $badrec;
 my $curatom = 'class';
+
 ##fixme:  maybe wrap this in an eval() instead of the warn/badrec/last bits?
-for (my ($atom) = /^([\w\d]+)\s/; $nc < 3; $nc++) {
-  if ($atom =~ /^\d+$/) {
-    if (defined($seenatoms{ttl})) {
-      warn "bad record ($origrec)\n";
-      $badrec = 1;
-      last;
-    } else {
-      if ($curatom ne 'class' && $curatom ne 'ttl') {
-        warn "bad record ($origrec)\n";
-        $badrec = 1;
-        last;
-      }
-      $curatom = 'ttl';
-      $seenatoms{ttl} = $atom;
-    }
-  }
-  if ($atom =~ /^IN|CS|CH|HS$/) {
-    if ($atom =~ /CS|CH|HS/) {
-      warn "unsupported class $atom in record ($origrec)\n";
-      $badrec = 1;
-      last;
-    }
-    $curatom = 'class';
-  }
-  if ($reverse_typemap{$atom}) {
-    print "dbg: type $atom\n";
-  }
-#  my $itype = $reverse_typemap{$type};
-}
-
-next if $badrec;
+eval {
+  for (; $nc < 3; $nc++) {
+    my ($atom) = ($rec =~ /^([\w\d.]+)\s/);
+    if ($atom =~ /^\d+$/) {
+      if (defined($seenatoms{ttl})) {
+        die "bad record ($origrec)\n";
+#        warn "bad record ($origrec)\n";
+#        $badrec = 1;
+#        last;
+      } else {
+        if ($curatom ne 'class' && $curatom ne 'ttl') {
+          die "bad record ($origrec)\n";
+#          warn "bad record ($origrec)\n";
+#          $badrec = 1;
+#          last;
+        }
+        $curatom = 'ttl';
+        $seenatoms{ttl} = $atom;
+      }
+    }
+    if ($atom =~ /^IN|CS|CH|HS$/) {
+      if ($atom =~ /CS|CH|HS/) {
+        die "unsupported class $atom in record ($origrec)\n";
+#        warn "unsupported class $atom in record ($origrec)\n";
+#        $badrec = 1;
+#        last;
+      }
+      $curatom = 'class';
+    }
+    if ($reverse_typemap{$atom}) {
+      print "dbg: type $atom\n";
+    }
+#    my $itype = $reverse_typemap{$type};
+  }
+};
+if ($@) {
+  warn $@;
+  next;
+}
+
+#next if $badrec;
 
 
