From d08068ae36a21fe4bd0c31d01ca8ef5b8f3d5a7d Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 29 Sep 2009 19:06:47 +0000 Subject: xpp: xpp_sync: add -v and fix perldoc git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7252 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/xpp_sync | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/xpp/xpp_sync b/xpp/xpp_sync index 44f8e39..41cfd61 100755 --- a/xpp/xpp_sync +++ b/xpp/xpp_sync @@ -9,6 +9,7 @@ # use strict; use File::Basename; +use Getopt::Std; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } use Dahdi::Xpp; @@ -21,16 +22,17 @@ sub usage() { print "$0: show / set Astribank sync source\n". "\n". - "Usage: $0 Show sync source.\n". - " $0 Set sync source.\n". + "Usage: $0 [-v] Show sync source.\n". + " $0 [-v] Set sync source.\n". ""; + exit 1; } +my %opts; +getopts('hv', \%opts) || usage; + +$opts{h} && usage; if(@ARGV == 1) { - if ($ARGV[0] =~ /^(-h|--help|help)$/) { - usage; - exit(0); - } $sync = shift; $autoselect = 1 if $sync =~ /^auto$/i; } @@ -52,7 +54,7 @@ sub get_sorted_xpds() { } } my @xpd_prio = Dahdi::Xpp::Xpd::xpds_by_rank(@good_xpds); - #Dahdi::Xpp::Xpd::show_xpd_rank(@xpd_prio); + Dahdi::Xpp::Xpd::show_xpd_rank(@xpd_prio) if $opts{v}; return @xpd_prio; } @@ -143,7 +145,9 @@ xpp_sync - Handle sync selection of Xorcom Astribanks. =head1 SYNOPSIS -xpp_sync [auto|dahdi|nn] +xpp_sync + +xpp_sync [-v] =head1 DESCRIPTION @@ -173,6 +177,10 @@ Gets synchronization from the Dahdi sync master. Sets XBUS-I as sync source. +=item -v + +Also print the numeric xpp sync rank. + =back (Parameter name is case-insensitive) @@ -211,8 +219,8 @@ xpp_sync is essentially a nicer interface to /proc/xpp/sync . That file shows the current xpp sync master (and in what format you need to write to it to set the master). +=back + =head1 SEE ALSO dahdi_registration(1), dahdi_cfg(1), README.Astribank - -=back -- cgit v1.2.3