summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-06-23 13:26:00 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-06-23 13:26:00 -0500
commit7ea8dd992e3b03aede386c78c4ad8bfb2fa90c9f (patch)
tree7ad10f298bb2cb30ad3c2bfdaa55f9391ab1f79b
parent6686965317a415a03b6ef5dbb597565eda53a2e5 (diff)
downloadvyatta-op-7ea8dd992e3b03aede386c78c4ad8bfb2fa90c9f.tar.gz
vyatta-op-7ea8dd992e3b03aede386c78c4ad8bfb2fa90c9f.zip
Make interface states more readable by using capital letters; fix bug in description output when there isn't an ip assigned
-rwxr-xr-xscripts/vyatta-show-interfaces.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 885f66e..6e2e550 100755
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -235,9 +235,9 @@ sub run_show_intf {
sub conv_brief_code {
my $state = pop(@_);
- $state = 'u' if ($state eq 'up');
- $state = 'd' if ($state eq 'down');
- $state = 'a' if ($state eq 'admin down');
+ $state = 'U' if ($state eq 'up');
+ $state = 'D' if ($state eq 'down');
+ $state = 'A' if ($state eq 'admin down');
return $state;
}
@@ -261,7 +261,7 @@ sub run_show_intf_brief {
my @intfs = @_;
my $format = "%-11s %-33s %-4s %-29s\n";
my $format2 = "%-11s %-33s\n";
- print "Codes: S - State, L - Link, u - Up, d - Down, a - Admin Down\n";
+ print "Codes: S - State, L - Link, U - Up, D - Down, A - Admin Down\n";
printf($format, "Interface","IP Address","S/L","Description");
printf($format, "---------","----------","---","-----------");
foreach my $intf (@intfs) {
@@ -275,7 +275,12 @@ sub run_show_intf_brief {
my $description = get_intf_description($intf);
my @descriptions = conv_descriptions($description);
if (scalar(@ip_addr) == 0) {
- printf($format, $intf, "-", "$state/$link", $description);
+ my $desc = '';
+ $desc = shift @descriptions if (scalar(@descriptions) > 0 );
+ printf($format, $intf, "-", "$state/$link", $desc);
+ foreach my $descrip (@descriptions){
+ printf($format, '', '', '', $descrip);
+ }
} else {
my $tmpip = shift(@ip_addr);
my $desc = '';