xref: /freebsd/contrib/ntp/scripts/update-leap/update-leap-opts (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1# EDIT THIS FILE WITH CAUTION  (update-leap-opts)
2#
3# It has been AutoGen-ed  January 20, 2016 at 04:10:30 AM by AutoGen 5.18.5
4# From the definitions    update-leap-opts.def
5# and the template file   perlopt
6
7use Getopt::Long qw(GetOptionsFromArray);
8Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9
10my $usage;
11
12sub usage {
13    my ($ret) = @_;
14    print STDERR $usage;
15    exit $ret;
16}
17
18sub 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
28sub 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';
49update-leap - leap-seconds file manager/updater - Ver. 4.2.8p6
50USAGE: 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
62Options are specified by doubled hyphens and their name or by a single
63hyphen and the flag character.
64USAGE
65
66    usage(0)       if $opts->{'help'};
67    paged_usage(0) if $opts->{'more-help'};
68    $_[0] = $opts;
69    return $ret;
70}
71
72END { close STDOUT };
73