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