ntptrace-opts revision 301256
11541Srgrimes# EDIT THIS FILE WITH CAUTION (ntptrace-opts) 21541Srgrimes# 31541Srgrimes# It has been AutoGen-ed June 2, 2016 at 07:24:57 AM by AutoGen 5.18.5 41541Srgrimes# From the definitions ntptrace-opts.def 51541Srgrimes# and the template file perlopt 61541Srgrimes 71541Srgrimesuse Getopt::Long qw(GetOptionsFromArray); 81541SrgrimesGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always)); 91541Srgrimes 101541Srgrimesmy $usage; 111541Srgrimes 121541Srgrimessub usage { 131541Srgrimes my ($ret) = @_; 141541Srgrimes print STDERR $usage; 151541Srgrimes exit $ret; 161541Srgrimes} 171541Srgrimes 181541Srgrimessub paged_usage { 191541Srgrimes my ($ret) = @_; 201541Srgrimes my $pager = $ENV{PAGER} || '(less || more)'; 211541Srgrimes 221541Srgrimes open STDOUT, "| $pager" or die "Can't fork a pager: $!"; 231541Srgrimes print $usage; 241541Srgrimes 251541Srgrimes exit $ret; 261541Srgrimes} 271541Srgrimes 281541Srgrimessub processOptions { 291541Srgrimes my $args = shift; 301541Srgrimes 311541Srgrimes my $opts = { 321541Srgrimes 'numeric' => '', 331541Srgrimes 'max-hosts' => '99', 341541Srgrimes 'host' => '127.0.0.1', 351541Srgrimes 'help' => '', 'more-help' => '' 361541Srgrimes }; 371541Srgrimes my $argument = '[host]'; 381541Srgrimes my $ret = GetOptionsFromArray($args, $opts, ( 391541Srgrimes 'numeric|n', 'max-hosts|m=i', 'host|r=s', 401541Srgrimes 'help|?', 'more-help')); 411541Srgrimes 421541Srgrimes $usage = <<'USAGE'; 431541Srgrimesntptrace - Trace peers of an NTP server - Ver. 4.2.8p8 441541SrgrimesUSAGE: ntptrace [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [host] 451541Srgrimes 461541Srgrimes -n, --numeric Print IP addresses instead of hostnames 471541Srgrimes -m, --max-hosts=num Maximum number of peers to trace 481541Srgrimes -r, --host=str Single remote host 491541Srgrimes -?, --help Display usage information and exit 501541Srgrimes --more-help Pass the extended usage text through a pager 511541Srgrimes 521541SrgrimesOptions are specified by doubled hyphens and their name or by a single 531541Srgrimeshyphen and the flag character. 541541SrgrimesUSAGE 551541Srgrimes 561541Srgrimes usage(0) if $opts->{'help'}; 571541Srgrimes paged_usage(0) if $opts->{'more-help'}; 581541Srgrimes $_[0] = $opts; 591541Srgrimes return $ret; 601541Srgrimes} 611541Srgrimes 621541SrgrimesEND { close STDOUT }; 631541Srgrimes