]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/scripts/calc_tickadj/calc_tickadj-opts
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / scripts / calc_tickadj / calc_tickadj-opts
1 # EDIT THIS FILE WITH CAUTION  (calc_tickadj-opts)
2 #
3 # It has been AutoGen-ed  August 31, 2014 at 04:52:46 AM by AutoGen 5.18.4
4 # From the definitions    calc_tickadj-opts.def
5 # and the template file   perlopt
6
7 use Getopt::Long qw(GetOptionsFromArray);
8 Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9
10 my $usage;
11
12 sub usage {
13     my ($ret) = @_;
14     print STDERR $usage;
15     exit $ret;
16 }
17
18 sub 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
28 sub processOptions {
29     my $args = shift;
30
31     my $opts = {
32         'drift-file' => '/etc/ntp/drift',
33         'tick' => '',
34         'help' => '', 'more-help' => ''
35     };
36     my $argument = '';
37     my $ret = GetOptionsFromArray($args, $opts, (
38         'drift-file|d=s', 'tick|t=i',
39         'help|?', 'more-help'));
40
41     $usage = <<'USAGE';
42 calc_tickadj - Calculates "optimal" value for tick given ntp drift file. - Ver. 4.2.7p467
43 USAGE: calc_tickadj [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
44
45     -d, --drift-file=str         Ntp drift file to use
46     -t, --tick=num               Tick value of this host
47     -?, --help                   Display usage information and exit
48         --more-help              Pass the extended usage text through a pager
49
50 Options are specified by doubled hyphens and their name or by a single
51 hyphen and the flag character.
52 USAGE
53
54     usage(0)       if $opts->{'help'};
55     paged_usage(0) if $opts->{'more-help'};
56     $_[0] = $opts;
57     return $ret;
58 }
59
60 END { close STDOUT };