update-leap-opts revision 290001
1219019Sgabor# EDIT THIS FILE WITH CAUTION  (update-leap-opts)
2219019Sgabor#
3219019Sgabor# It has been AutoGen-ed  October 21, 2015 at 12:34:44 PM by AutoGen 5.18.5
4219019Sgabor# From the definitions    update-leap-opts.def
5219019Sgabor# and the template file   perlopt
6219019Sgabor
7219019Sgaboruse Getopt::Long qw(GetOptionsFromArray);
8219019SgaborGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9219019Sgabor
10219019Sgabormy $usage;
11219019Sgabor
12219019Sgaborsub usage {
13219019Sgabor    my ($ret) = @_;
14219019Sgabor    print STDERR $usage;
15219019Sgabor    exit $ret;
16219019Sgabor}
17219019Sgabor
18219019Sgaborsub paged_usage {
19219019Sgabor    my ($ret) = @_;
20219019Sgabor    my $pager = $ENV{PAGER} || '(less || more)';
21219019Sgabor
22219019Sgabor    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
23219019Sgabor    print $usage;
24219019Sgabor
25219019Sgabor    exit $ret;
26219019Sgabor}
27219019Sgabor
28219019Sgaborsub processOptions {
29219019Sgabor    my $args = shift;
30219019Sgabor
31219019Sgabor    my $opts = {
32219019Sgabor        'source-url' => '',
33219019Sgabor        'ipv4' => '',
34219019Sgabor        'destination' => '',
35219019Sgabor        'expiration' => '',
36219019Sgabor        'ntp-conf-file' => '',
37219019Sgabor        'force-update' => '',
38219019Sgabor        'dont-wait' => '',
39219019Sgabor        'help' => '', 'more-help' => ''
40219019Sgabor    };
41219019Sgabor    my $argument = '';
42219019Sgabor    my $ret = GetOptionsFromArray($args, $opts, (
43219019Sgabor        'source-url|s=s', 'ipv4|4', 'destination|d=f',
44219019Sgabor        'expiration|e=s', 'ntp-conf-file|f=s', 'force-update|F',
45219019Sgabor        'dont-wait',
46219019Sgabor        'help|?', 'more-help'));
47219019Sgabor
48219019Sgabor    $usage = <<'USAGE';
49219019Sgaborupdate-leap - leap-seconds file manager/updater - Ver. 4.2.8p4
50219019SgaborUSAGE: update-leap [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
51219019Sgabor
52219019Sgabor    -s, --source-url=str         The URL of the master copy of the leapseconds file
53219019Sgabor    -4, --ipv4                   Use only IPv4 addresses for DNS name resolution
54219019Sgabor    -d, --destination=float      Filename on the local system
55219019Sgabor    -e, --expiration=str         Refresh the leapfile this long before it expires
56219019Sgabor    -f, --ntp-conf-file=str      Location of the ntp.conf file
57219019Sgabor    -F, --force-update           Force update of the leapfile
58219019Sgabor        --dont-wait              Don't wait for keystroke between plots
59219019Sgabor    -?, --help                   Display usage information and exit
60219019Sgabor        --more-help              Pass the extended usage text through a pager
61219019Sgabor
62219019SgaborOptions are specified by doubled hyphens and their name or by a single
63219019Sgaborhyphen and the flag character.
64219019SgaborUSAGE
65219019Sgabor
66219019Sgabor    usage(0)       if $opts->{'help'};
67219019Sgabor    paged_usage(0) if $opts->{'more-help'};
68219019Sgabor    $_[0] = $opts;
69219019Sgabor    return $ret;
70219019Sgabor}
71219019Sgabor
72219019SgaborEND { close STDOUT };
73219019Sgabor