Home | History | Annotate | Line # | Download | only in update-leap
update-leap-opts revision 1.1.1.1.2.7
      1 # EDIT THIS FILE WITH CAUTION  (update-leap-opts)
      2 #
      3 # It has been AutoGen-ed  March 21, 2017 at 10:40:36 AM by AutoGen 5.18.5
      4 # From the definitions    update-leap-opts.def
      5 # and the template file   perlopt
      6 
      7 use Getopt::Long qw(GetOptionsFromArray);
      8 Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
      9 
     10 my $usage;
     11 
     12 sub usage {
     13     my ($ret) = @_;
     14     print STDERR $usage;
     15     exit $ret;
     16 }
     17 
     18 sub 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 
     28 sub processOptions {
     29     my $args = shift;
     30 
     31     my $opts = {
     32         'source-url' => '',
     33         'ipv4' => '',
     34         'destination' => '',
     35         'expiration' => '',
     36         'ntp-conf-file' => '',
     37         'force-update' => '',
     38         'dont-wait' => '',
     39         'help' => '', 'more-help' => ''
     40     };
     41     my $argument = '';
     42     my $ret = GetOptionsFromArray($args, $opts, (
     43         'source-url|s=s', 'ipv4|4', 'destination|d=f',
     44         'expiration|e=s', 'ntp-conf-file|f=s', 'force-update|F',
     45         'dont-wait',
     46         'help|?', 'more-help'));
     47 
     48     $usage = <<'USAGE';
     49 update-leap - leap-seconds file manager/updater - Ver. 4.2.8p10
     50 USAGE: update-leap [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
     51 
     52     -s, --source-url=str         The URL of the master copy of the leapseconds file
     53     -4, --ipv4                   Use only IPv4 addresses for DNS name resolution
     54     -d, --destination=float      Filename on the local system
     55     -e, --expiration=str         Refresh the leapfile this long before it expires
     56     -f, --ntp-conf-file=str      Location of the ntp.conf file
     57     -F, --force-update           Force update of the leapfile
     58         --dont-wait              Don't wait for keystroke between plots
     59     -?, --help                   Display usage information and exit
     60         --more-help              Pass the extended usage text through a pager
     61 
     62 Options are specified by doubled hyphens and their name or by a single
     63 hyphen and the flag character.
     64 USAGE
     65 
     66     usage(0)       if $opts->{'help'};
     67     paged_usage(0) if $opts->{'more-help'};
     68     $_[0] = $opts;
     69     return $ret;
     70 }
     71 
     72 END { close STDOUT };
     73