wrong subfield
[migration-tools.git] / marc-cleanup
index 998bfa5..8071de5 100755 (executable)
@@ -50,7 +50,7 @@ my $sidx = 0;
 while (my $line = getline()) {
     unless ($count % 2000) {
         print "\rWorking... ", $spinner[$sidx];
-        $sidx = $sidx > $#spinner ? 0 : $sidx++;
+        $sidx = ($sidx == $#spinner) ? 0 : $sidx + 1;
     }
     update_linecontext();
 
@@ -84,14 +84,13 @@ while (my $line = getline()) {
 
     # naked ampersands
     if ($line =~ /&/ && $line !~ /&\w+?;/)
-      { edit("Looks like naked ampersand", $line); next }
+      { edit("Naked ampersand", $line); next }
 
     # subfields can't be non-alphanumeric
     if ($line =~ /<subfield code="(.+?)"/) {
         my $match = $1;
         if ($match =~ /\P{IsAlnum}/) {
-            print $OUT "\n$match\n";
-            edit("Junk in subfield", $line);
+            edit("Junk in subfield code", $line);
             next;
         }
     }
@@ -111,7 +110,7 @@ sub edit {
     print $OUT "\r".$msg, " at line $count:\n";
     print_context();
     while (1) {
-        my $line = $term->readline('yaz-cleanup>');
+        my $line = $term->readline('marc-cleanup>');
         if (length $line < 2)
           { next unless (defined $commands{$line}) }
         if (defined $commands{$line}) {