Change 19838 by [EMAIL PROTECTED] on 2003/06/22 16:16:01

        Debian fix from Brendan O'Dea:
        Adjust output to screen width.
        (adjusted to probe for the stty command)

Affected files ...

... //depot/perl/utils/dprofpp.PL#13 edit

Differences ...

==== //depot/perl/utils/dprofpp.PL#13 (text) ====
Index: perl/utils/dprofpp.PL
--- perl/utils/dprofpp.PL#12~19003~     Sun Mar 16 17:23:02 2003
+++ perl/utils/dprofpp.PL       Sun Jun 22 09:16:01 2003
@@ -31,6 +31,13 @@
 if( $VERSION == 0 ){
        die "Did not find VERSION in $dprof_pm";
 }
+my $stty = 'undef';
+foreach my $s (qw(/bin/stty /usr/bin/stty)) {
+    if (-x $s) {
+       $stty = qq["$s"];
+       last;
+    }
+}
 open OUT,">$file" or die "Can't create $file: $!";
 
 print "Extracting $file (with variable substitutions)\n";
@@ -46,6 +53,7 @@
 require 5.003;
 
 my \$VERSION = '$VERSION';
+my \$stty    = $stty;
 
 !GROK!THIS!
 
@@ -937,11 +945,17 @@
 %Time ExclSec CumulS #Calls sec/call Csec/c  Name
 .
 
-format STAT =
- ^>>>   ^>>>> ^>>>>> ^>>>>>   ^>>>>> ^>>>>>  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-$pcnt, $secs, $csecs, $ncalls, $percall, $cpercall, $name
-.
+BEGIN {
+    my $fmt = ' ^>>>   ^>>>> ^>>>>> ^>>>>>   ^>>>>> ^>>>>>  
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<';
+    if (-t STDOUT and defined $stty and my ($cols) = `$stty -a` =~ 
/\bcolumns\s+(\d+)/)
+    {
+       $fmt .= '<' x ($cols - length $fmt) if $cols > 80;
+    }
 
+    eval "format STAT = \n$fmt" . '
+$pcnt, $secs, $csecs, $ncalls, $percall, $cpercall, $name
+.';
+}
 !NO!SUBS!
 
 close OUT or die "Can't close $file: $!";
End of Patch.

Reply via email to