#!/usr/bin/perl $maxlen = 1024; $count = 0; $whyme = 0; sub break { while (<>) { # why am i doing this if ($count++ == 500) { $whyme++; ($whyme >= 10) && ($whyme = -8); if ($whyme > 0 && $whyme < 10) { print STDERR "."; } else { print STDERR "\b \b"; } $count=0; } if (substr($_, -1) eq "\n") { chop; } if (!length) { print "\n"; next; } while(length > $maxlen) { $line=substr($_,0,$maxlen); $_=substr($_,$maxlen); print "$line\\\n"; } if(length > 0) { print "$_\n"; } } } sub join { $buffer = ""; while (<>) { # why am i doing this if ($count++ == 500) { $whyme++; ($whyme >= 10) && ($whyme = -8); if ($whyme > 0 && $whyme < 10) { print STDERR "."; } else { print STDERR "\b \b"; } $count=0; } if (substr($_, -1) eq "\n") { chop; } if (substr($_, -1) eq '\\') { chop; $buffer = "$buffer$_"; } else { print "$buffer$_\n"; $buffer = ""; } } } select(STDERR); $| = 1; select(STDOUT); $_ = $ARGV[0]; if (/^-b/) { print STDERR "Breaking db..."; shift; &break(); } elsif (/^-u/) { print STDERR "Unbreaking db..."; shift; &join(); } else { print STDERR<<END; Usage: `dumpbreak <option> infile > outfile` Will read from "infile" and write to stdout (redirect to "outfile"). Options: -b -- break db lines -u -- unbreak db lines END exit(0); } print STDERR "\n";