]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/scripts/ntpsweep/ntpsweep-opts
Fix ntp multiple vulnerabilities.
[FreeBSD/releng/10.2.git] / contrib / ntp / scripts / ntpsweep / ntpsweep-opts
1 # EDIT THIS FILE WITH CAUTION  (ntpsweep-opts)
2 #
3 # It has been AutoGen-ed  April 26, 2016 at 08:24:28 PM by AutoGen 5.18.5
4 # From the definitions    ntpsweep-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         'host-list' => [],
33         'peers' => '',
34         'maxlevel' => '',
35         'strip' => '',
36         'host' => '',
37         'help' => '', 'more-help' => ''
38     };
39     my $argument = '[hostfile]';
40     my $ret = GetOptionsFromArray($args, $opts, (
41         'host-list|l=s', 'peers|p', 'maxlevel|m=i',
42         'strip|s=s', 'host|h=s',
43         'help|?', 'more-help'));
44
45     $usage = <<'USAGE';
46 ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
47 USAGE: ntpsweep [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostfile]
48
49     -l, --host-list=str          Host to execute actions on
50                                    - may appear multiple times
51     -p, --peers                  Recursively list all peers a host synchronizes to
52     -m, --maxlevel=num           Traverse peers up to this level (4 is a reasonable number)
53     -s, --strip=str              Strip this string from hostnames
54     -?, --help                   Display usage information and exit
55         --more-help              Pass the extended usage text through a pager
56
57 Options are specified by doubled hyphens and their name or by a single
58 hyphen and the flag character.
59 USAGE
60
61     usage(0)       if $opts->{'help'};
62     paged_usage(0) if $opts->{'more-help'};
63     $_[0] = $opts;
64     return $ret;
65 }
66
67 END { close STDOUT };