X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdiagnostics.pm;h=5e8e971f4438bad1f68c37bdfb543217a3fb41b1;hb=1b33cabaaf2fbe2e84c6a13a9b0a7fce45959c4f;hp=3492bd3e28ed2b94aa99e28f488154c13474d56f;hpb=2223696182def99cda82e756db80d13949fc882e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index 3492bd3..5e8e971 100644 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -158,12 +158,11 @@ a program named I, you should expect a bit of whimsy. =head1 AUTHOR -Tom Christiansen Ftchrist@mox.perl.comE>, 25 June 1995. +Tom Christiansen >, 25 June 1995. =cut require 5.001; -use English; use Carp; use Config; @@ -177,7 +176,7 @@ else { $DEBUG ||= 0; my $WHOAMI = ref bless []; # nobody's business, prolly not even mine -$OUTPUT_AUTOFLUSH = 1; +$| = 1; local $_; @@ -313,7 +312,9 @@ EOFUNC } next; } - $header = $1; + + # strip formatting directives in =item line + ($header = $1) =~ s/[A-Z]<(.*?)>/$1/g; if ($header =~ /%[sd]/) { $rhs = $lhs = $header; @@ -326,8 +327,9 @@ EOFUNC #$lhs =~ s/\377([^\377]*)$/\Q$1\E\$/; $lhs =~ s/\377([^\377]*)$/\Q$1\E/; $lhs =~ s/\377//g; + $lhs =~ s/\.\*\?$/.*/; # Allow %s at the end to eat it all } - $transmo .= " s{^$lhs}\n {\Q$rhs\E}\n\t&& return 1;\n"; + $transmo .= " s{^$lhs}\n {\Q$rhs\E}s\n\t&& return 1;\n"; } else { $transmo .= " m{^\Q$header\E} && return 1;\n"; } @@ -352,7 +354,7 @@ EOFUNC if ($standalone) { if (!@ARGV and -t STDIN) { print STDERR "$0: Reading from STDIN\n" } - while ($error = <>) { + while (defined ($error = <>)) { splainthis($error) || print THITHER $error; } exit; @@ -497,7 +499,7 @@ sub unescape { exists $HTML_Escapes{$1} ? do { $HTML_Escapes{$1} } : do { - warn "Unknown escape: $& in $_"; + warn "Unknown escape: E<$1> in $_"; "E<$1>"; } } @@ -506,7 +508,7 @@ sub unescape { sub shorten { my $line = $_[0]; - if (length $line > 79) { + if (length($line) > 79 and index($line, "\n") == -1) { my $space_place = rindex($line, ' ', 79); if ($space_place != -1) { substr($line, $space_place, 1) = "\n\t";