1275970Scy# EDIT THIS FILE WITH CAUTION  (calc_tickadj-opts)
2275970Scy#
3275970Scy# It has been AutoGen-ed  August 31, 2014 at 04:52:46 AM by AutoGen 5.18.4
4275970Scy# From the definitions    calc_tickadj-opts.def
5275970Scy# and the template file   perlopt
6275970Scy
7275970Scyuse Getopt::Long qw(GetOptionsFromArray);
8275970ScyGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9275970Scy
10275970Scymy $usage;
11275970Scy
12275970Scysub usage {
13275970Scy    my ($ret) = @_;
14275970Scy    print STDERR $usage;
15275970Scy    exit $ret;
16275970Scy}
17275970Scy
18275970Scysub paged_usage {
19275970Scy    my ($ret) = @_;
20275970Scy    my $pager = $ENV{PAGER} || '(less || more)';
21275970Scy
22275970Scy    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
23275970Scy    print $usage;
24275970Scy
25275970Scy    exit $ret;
26275970Scy}
27275970Scy
28275970Scysub processOptions {
29275970Scy    my $args = shift;
30275970Scy
31275970Scy    my $opts = {
32275970Scy        'drift-file' => '/etc/ntp/drift',
33275970Scy        'tick' => '',
34275970Scy        'help' => '', 'more-help' => ''
35275970Scy    };
36275970Scy    my $argument = '';
37275970Scy    my $ret = GetOptionsFromArray($args, $opts, (
38275970Scy        'drift-file|d=s', 'tick|t=i',
39275970Scy        'help|?', 'more-help'));
40275970Scy
41275970Scy    $usage = <<'USAGE';
42275970Scycalc_tickadj - Calculates "optimal" value for tick given ntp drift file. - Ver. 4.2.7p467
43275970ScyUSAGE: calc_tickadj [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
44275970Scy
45275970Scy    -d, --drift-file=str         Ntp drift file to use
46275970Scy    -t, --tick=num               Tick value of this host
47275970Scy    -?, --help                   Display usage information and exit
48275970Scy        --more-help              Pass the extended usage text through a pager
49275970Scy
50275970ScyOptions are specified by doubled hyphens and their name or by a single
51275970Scyhyphen and the flag character.
52275970ScyUSAGE
53275970Scy
54275970Scy    usage(0)       if $opts->{'help'};
55275970Scy    paged_usage(0) if $opts->{'more-help'};
56275970Scy    $_[0] = $opts;
57275970Scy    return $ret;
58275970Scy}
59275970Scy
60275970ScyEND { close STDOUT };
61