"Fossies" - the Fresh Open Source Software Archive

Member "ntp-4.2.8p15/scripts/ntpsweep/ntpsweep-opts" (23 Jun 2020, 1955 Bytes) of package /linux/misc/ntp-4.2.8p15.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "ntpsweep-opts": 4.2.8p14_vs_4.2.8p15.

    1 # EDIT THIS FILE WITH CAUTION  (ntpsweep-opts)
    2 #
    3 # It has been AutoGen-ed  June 23, 2020 at 02:21:34 AM 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.8p15
   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 };