diff options
Diffstat (limited to 'xpp/utils/xpp_sync')
-rwxr-xr-x | xpp/utils/xpp_sync | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/xpp/utils/xpp_sync b/xpp/utils/xpp_sync index d03c0a4..4bd1e86 100755 --- a/xpp/utils/xpp_sync +++ b/xpp/utils/xpp_sync @@ -8,7 +8,8 @@ # $Id$ # use strict; -BEGIN { my $dir = $0; $dir =~ s:/[^/]+$::; unshift(@INC, "$dir", "$dir/zconf"); } +use File::Basename; +BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } use Zaptel::Xpp; use Zaptel::Xpp::Xbus; @@ -38,10 +39,19 @@ sub get_sorted_xpds() { } } - my @bri_xpds = grep { $_->type =~ /BRI/; } @good_xpds; + my @bri_nt_xpds = grep { $_->type eq 'BRI_NT'; } @good_xpds; + my @bri_te_xpds = grep { $_->type eq 'BRI_TE'; } @good_xpds; my @fxo_xpds = grep { $_->type eq 'FXO'; } @good_xpds; my @fxs_xpds = grep { $_->type eq 'FXS'; } @good_xpds; - return (@bri_xpds, @fxo_xpds, @fxs_xpds); + + # Sync Priority + return + @pri_nt_xpds, + @bri_nt_xpds, + @fxo_xpds, + @pri_te_xpds, + @bri_te_xpds, + @fxs_xpds; } sub do_select(@) { @@ -88,13 +98,30 @@ sub show_sync() { my @xpds = $xbus->xpds; my @types = map { $_->type } @xpds; my $mark = ($curr_sync =~ /\d+/ and $xbus->num == $curr_sync)?"+":""; - printf "\t%1s %s [ ", $mark, $xbus->name; - foreach my $x (sort { $a->num <=> $b->num } @xpds) { - printf "%-3s ", $x->type; + my $xpdstr = ''; + my @xpd_types = map { $_->type } sort { $a->num <=> $b->num } @xpds; + my $last_type = ''; + my $mult = 0; + foreach my $curr (@xpd_types) { + if(!$last_type || ($curr eq $last_type)) { + $mult++; + } else { + if($mult == 1) { + $xpdstr .= "$last_type "; + } elsif($mult) { + $xpdstr .= "$last_type*$mult "; + } + $mult = 1; + } + $last_type = $curr; + } + if($mult == 1) { + $xpdstr .= "$last_type "; + } elsif($mult) { + $xpdstr .= "$last_type*$mult "; } - print "]"; - my $padding = ' ' x (4 * (8 - @xpds)); - printf "%s (%s)\n", $padding, $xbus->connector; + my $padding = ' ' x (40 - length $xpdstr); + printf " %1s %s [ %s]%s (%s)\n", $mark, $xbus->name, $xpdstr, $padding, $xbus->connector; } } |