summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-22 16:16:01 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-22 16:16:01 +0000
commitccc0622a5e7618aee538d32edf64a5e4687cd025 (patch)
tree08c38841f19e068498c4c6e006b84cccea48de97 /utils
parent0e488909c71aa4d1cc21ed7dbfb5b99551c99af1 (diff)
downloadperl-ccc0622a5e7618aee538d32edf64a5e4687cd025.tar.gz
Debian fix from Brendan O'Dea:
Adjust output to screen width. (adjusted to probe for the stty command) p4raw-id: //depot/perl@19838
Diffstat (limited to 'utils')
-rw-r--r--utils/dprofpp.PL22
1 files changed, 18 insertions, 4 deletions
diff --git a/utils/dprofpp.PL b/utils/dprofpp.PL
index dfe9d3dbbf..8c2ef79da0 100644
--- a/utils/dprofpp.PL
+++ b/utils/dprofpp.PL
@@ -31,6 +31,13 @@ close PM;
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 @@ $Config{'startperl'}
require 5.003;
my \$VERSION = '$VERSION';
+my \$stty = $stty;
!GROK!THIS!
@@ -937,11 +945,17 @@ $incl_excl
%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: $!";