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