1# EDIT THIS FILE WITH CAUTION (summary-opts) 2# 3# It has been AutoGen-ed June 6, 2023 at 04:39:35 AM by AutoGen 5.18.16 4# From the definitions summary-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 'directory' => '/var/log/ntp', 33 'end-date' => '', 34 'output-directory' => '/tmp', 35 'peer-dist-limit' => '400', 36 'skip-time-steps' => '3600', 37 'start-date' => '19700101', 38 'help' => '', 'more-help' => '' 39 }; 40 my $argument = ''; 41 my $ret = GetOptionsFromArray($args, $opts, ( 42 'directory=s', 'end-date=i', 'output-directory=s', 43 'peer-dist-limit=f', 'skip-time-steps=f', 'start-date=i', 44 'help|?', 'more-help')); 45 46 $usage = <<'USAGE'; 47summary - compute various stastics from NTP stat files - Ver. 4.2.8p17 48USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 49 50 --directory=str Directory containing stat files 51 --end-date=num End date 52 --output-directory=str Output directory 53 --peer-dist-limit=float Peer dist limit 54 --skip-time-steps=float Ignore time offsets larger that this 55 --start-date=num Start date 56 -?, --help Display usage information and exit 57 --more-help Pass the extended usage text through a pager 58 59Options are specified by doubled hyphens and their name or by a single 60hyphen and the flag character. 61USAGE 62 63 usage(0) if $opts->{'help'}; 64 paged_usage(0) if $opts->{'more-help'}; 65 $_[0] = $opts; 66 return $ret; 67} 68 69END { close STDOUT }; 70