1*2b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION (ntpsweep-opts) 2*2b15cb3dSCy Schubert# 3*2b15cb3dSCy Schubert# It has been AutoGen-ed February 4, 2015 at 02:37:31 AM by AutoGen 5.18.5pre4 4*2b15cb3dSCy Schubert# From the definitions ntpsweep-opts.def 5*2b15cb3dSCy Schubert# and the template file perlopt 6*2b15cb3dSCy Schubert 7*2b15cb3dSCy Schubertuse Getopt::Long qw(GetOptionsFromArray); 8*2b15cb3dSCy SchubertGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always)); 9*2b15cb3dSCy Schubert 10*2b15cb3dSCy Schubertmy $usage; 11*2b15cb3dSCy Schubert 12*2b15cb3dSCy Schubertsub usage { 13*2b15cb3dSCy Schubert my ($ret) = @_; 14*2b15cb3dSCy Schubert print STDERR $usage; 15*2b15cb3dSCy Schubert exit $ret; 16*2b15cb3dSCy Schubert} 17*2b15cb3dSCy Schubert 18*2b15cb3dSCy Schubertsub paged_usage { 19*2b15cb3dSCy Schubert my ($ret) = @_; 20*2b15cb3dSCy Schubert my $pager = $ENV{PAGER} || '(less || more)'; 21*2b15cb3dSCy Schubert 22*2b15cb3dSCy Schubert open STDOUT, "| $pager" or die "Can't fork a pager: $!"; 23*2b15cb3dSCy Schubert print $usage; 24*2b15cb3dSCy Schubert 25*2b15cb3dSCy Schubert exit $ret; 26*2b15cb3dSCy Schubert} 27*2b15cb3dSCy Schubert 28*2b15cb3dSCy Schubertsub processOptions { 29*2b15cb3dSCy Schubert my $args = shift; 30*2b15cb3dSCy Schubert 31*2b15cb3dSCy Schubert my $opts = { 32*2b15cb3dSCy Schubert 'host-list' => [], 33*2b15cb3dSCy Schubert 'peers' => '', 34*2b15cb3dSCy Schubert 'maxlevel' => '', 35*2b15cb3dSCy Schubert 'strip' => '', 36*2b15cb3dSCy Schubert 'host' => '', 37*2b15cb3dSCy Schubert 'help' => '', 'more-help' => '' 38*2b15cb3dSCy Schubert }; 39*2b15cb3dSCy Schubert my $argument = '[hostfile]'; 40*2b15cb3dSCy Schubert my $ret = GetOptionsFromArray($args, $opts, ( 41*2b15cb3dSCy Schubert 'host-list|l=s', 'peers|p', 'maxlevel|m=i', 42*2b15cb3dSCy Schubert 'strip|s=s', 'host|h=s', 43*2b15cb3dSCy Schubert 'help|?', 'more-help')); 44*2b15cb3dSCy Schubert 45*2b15cb3dSCy Schubert $usage = <<'USAGE'; 46*2b15cb3dSCy Schubertntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p1 47*2b15cb3dSCy SchubertUSAGE: ntpsweep [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostfile] 48*2b15cb3dSCy Schubert 49*2b15cb3dSCy Schubert -l, --host-list=str Host to execute actions on 50*2b15cb3dSCy Schubert - may appear multiple times 51*2b15cb3dSCy Schubert -p, --peers Recursively list all peers a host synchronizes to 52*2b15cb3dSCy Schubert -m, --maxlevel=num Traverse peers up to this level (4 is a reasonable number) 53*2b15cb3dSCy Schubert -s, --strip=str Strip this string from hostnames 54*2b15cb3dSCy Schubert -?, --help Display usage information and exit 55*2b15cb3dSCy Schubert --more-help Pass the extended usage text through a pager 56*2b15cb3dSCy Schubert 57*2b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single 58*2b15cb3dSCy Schuberthyphen and the flag character. 59*2b15cb3dSCy SchubertUSAGE 60*2b15cb3dSCy Schubert 61*2b15cb3dSCy Schubert usage(0) if $opts->{'help'}; 62*2b15cb3dSCy Schubert paged_usage(0) if $opts->{'more-help'}; 63*2b15cb3dSCy Schubert $_[0] = $opts; 64*2b15cb3dSCy Schubert return $ret; 65*2b15cb3dSCy Schubert} 66*2b15cb3dSCy Schubert 67*2b15cb3dSCy SchubertEND { close STDOUT }; 68