xref: /netbsd-src/external/bsd/ntp/dist/scripts/calc_tickadj/calc_tickadj-opts (revision 6cf6fe02a981b55727c49c3d37b0d8191a98c0ee)
1
2# DO NOT EDIT THE FOLLOWING
3#
4# It's auto generated option handling code
5
6use Getopt::Long qw(GetOptionsFromArray);
7Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
8
9my $usage;
10
11sub usage {
12    my ($ret) = @_;
13    print STDERR $usage;
14    exit $ret;
15}
16
17sub 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
27sub 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';
41calc_tickadj - Calculates "optimal" value for tick given ntp drift file.
42USAGE: 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
49Options are specified by doubled hyphens and their name or by a single
50hyphen and the flag character.
51USAGE
52
53    usage(0)       if $opts->{'help'};
54    paged_usage(0) if $opts->{'more-help'};
55    $_[0] = $opts;
56    return $ret;
57}
58
59END { close STDOUT };
60
61