Home | History | Annotate | Line # | Download | only in calc_tickadj
calc_tickadj-opts revision 1.1.1.1.4.2
      1 
      2 # DO NOT EDIT THE FOLLOWING
      3 #
      4 # It's auto generated option handling code  
      5 
      6 use Getopt::Long qw(GetOptionsFromArray);
      7 Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
      8 
      9 my $usage;
     10 
     11 sub usage {
     12     my ($ret) = @_;
     13     print STDERR $usage;
     14     exit $ret;
     15 }
     16 
     17 sub paged_usage {
     18     my ($ret) = @_;
     19     my $pager = $ENV{PAGER} || '(less || more)';
     20 
     21     open STDOUT, "| $pager" or die "Can't fork a pager: $!";
     22     print $usage;
     23 
     24     exit $ret;
     25 }
     26 
     27 sub processOptions {
     28     my $args = shift;
     29 
     30     my $opts = {
     31         'drift-file' => '/etc/ntp/drift',
     32         'tick' => '',
     33         'help' => '', 'more-help' => ''
     34     };
     35     my $argument = '';
     36     my $ret = GetOptionsFromArray($args, $opts, (
     37         'drift-file|d=s', 'tick|t=i',
     38         'help|?', 'more-help'));
     39 
     40     $usage = <<'USAGE';
     41 calc_tickadj - Calculates "optimal" value for tick given ntp drift file.
     42 USAGE: calc_tickadj [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
     43 
     44     -d, --drift-file=str         Ntp drift file to use
     45     -t, --tick=num               Tick value of this host
     46     -?, --help                   Display usage information and exit
     47       , --more-help              Pass the extended usage information through a pager
     48 
     49 Options are specified by doubled hyphens and their name or by a single
     50 hyphen and the flag character.
     51 USAGE
     52 
     53     usage(0)       if $opts->{'help'};
     54     paged_usage(0) if $opts->{'more-help'};
     55     $_[0] = $opts;
     56     return $ret;
     57 }
     58 
     59 END { close STDOUT };
     60 
     61