From cc8eeb92722361de26efb2204a011f9d361a148e Mon Sep 17 00:00:00 2001 From: John Southworth Date: Tue, 8 May 2012 14:59:17 -0700 Subject: Use terminal width for interface description wrapping --- scripts/vyatta-show-interfaces.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') 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 { -- cgit v1.2.3