X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fwatchdbg;h=7975529655809ac79b1e75447fb827f193f9c86f;hb=575db552c5a635ce2eb431de07f568113374735f;hp=4ac24be1b02dd34c69b1d0bb9b629640a7edf400;hpb=f18a5bbaecbb46d84daa3cfa7968697fb87da742;p=spider.git diff --git a/perl/watchdbg b/perl/watchdbg index 4ac24be1..79755296 100755 --- a/perl/watchdbg +++ b/perl/watchdbg @@ -43,7 +43,10 @@ for (;;) { if ($exp) { push @prev, $line; shift @prev while @prev > $nolines; - printit(@prev) if $line =~ m{(?:$exp)}oi; + if ($line =~ m{(?:$exp)}oi) { + printit(@prev); + @prev = (); + } } else { printit($line); } @@ -70,12 +73,14 @@ sub printit { while (@_) { my $line = shift; + chomp $line; + $line =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\x%02X", ord($1))/eg; my @line = split '\^', $line; my $t = shift @line; my ($sec,$min,$hour) = gmtime((defined $t) ? $t : time); my $buf = sprintf "%02d:%02d:%02d", $hour, $min, $sec; - print $buf, ' ', join('^', @line); + print $buf, ' ', join('^', @line), "\n"; } } exit(0);