summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2012-05-08 14:59:17 -0700
committerJohn Southworth <john.southworth@vyatta.com>2012-05-08 14:59:17 -0700
commitcc8eeb92722361de26efb2204a011f9d361a148e (patch)
treee1b7729e801a44e9cd28c96af51b8ccc78988421 /scripts
parent45c360bc1e7eda64f20f5cf51641ab830af2ee76 (diff)
downloadvyatta-op-cc8eeb92722361de26efb2204a011f9d361a148e.tar.gz
vyatta-op-cc8eeb92722361de26efb2204a011f9d361a148e.zip
Use terminal width for interface description wrapping
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-show-interfaces.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 36428cb..abc9ec6 100755
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -49,6 +49,8 @@ my %action_hash = (
my $clear_stats_dir = '/var/run/vyatta';
my $clear_file_magic = 'XYZZYX';
+my ($term_height, $term_width) = split ' ', `stty size`;
+
my @rx_stat_vars =
qw/rx_bytes rx_packets rx_errors rx_dropped rx_over_errors multicast/;
my @tx_stat_vars =
@@ -237,9 +239,10 @@ sub conv_brief_code {
sub conv_descriptions {
my $description = pop @_;
my @descriptions;
+ my $desc_len = $term_width - 56;
my $line = '';
foreach my $elem (split(' ', $description)){
- if ((length($line) + length($elem)) >= 24){
+ if ((length($line) + length($elem)) >= $desc_len){
push(@descriptions, $line);
$line = "$elem ";
} else {