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