From b9de04f1f1121aedf8ad9db34c1952c57b9dbf0c Mon Sep 17 00:00:00 2001 From: Ben Ostrowsky Date: Thu, 18 Nov 2010 21:09:03 +0000 Subject: [PATCH] A few adjustments --- bibliofile/parse_db.pl | 1 - bibliofile/parse_dbd.pl | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bibliofile/parse_db.pl b/bibliofile/parse_db.pl index b7b691d..c14f958 100755 --- a/bibliofile/parse_db.pl +++ b/bibliofile/parse_db.pl @@ -86,7 +86,6 @@ while (read DB, my $data, $blockSize) { if ($field[0] =~ m/[^\x00]/) { print join("\t", @field) . "\n"; - #print STDERR "Length: $pos\n"; } } diff --git a/bibliofile/parse_dbd.pl b/bibliofile/parse_dbd.pl index f72347c..938a52c 100755 --- a/bibliofile/parse_dbd.pl +++ b/bibliofile/parse_dbd.pl @@ -14,7 +14,7 @@ my $startOfColumnTypes = 8; while (<>) { my $dbd = $_; - my $rowlength = ord substr($dbd, 0, 1); + my $rowlength = ord(substr($dbd, 0, 1)) + (256 * (ord(substr($dbd, 1, 1)))); my $numcolumns = ord substr($dbd, 2, 1); my $extra = sprintf( "%02x %02x %02x", @@ -30,15 +30,15 @@ while (<>) { my $colnames = substr($dbd, $startOfColumnTypes + 7*$numcolumns - 2); my @col = split(/\x00/, $colnames); - #print "Row length: $rowlength\n"; - #print "Columns: $numcolumns\n"; - #print "Extra data: $extra\n"; - #print "Delimiter: $delimiter\n"; + print "Row length: $rowlength\n"; + print "Columns: $numcolumns\n"; + print "Extra data: $extra\n"; + print "Delimiter: $delimiter\n"; for (my $i = 1; $i <= $numcolumns; $i++) { my $coltype = substr($dbd, 7*($i-1)+$startOfColumnTypes, 1); my $collength = ord substr($dbd, 7*($i-1)+$startOfColumnTypes+1, 1); - printf ("Column %0" . length($numcolumns) . "d: %-8s %s (%d chars)\n", $i, $coltypes{$coltype}, $col[$i-1], $collength); + printf ("Column %02d: %-8s %s (%d chars)\n", $i, $coltypes{$coltype}, $col[$i-1], $collength); } } -- 1.7.2.5