"Fossies" - the Fresh Open Source Software Archive

Member "ntp-4.2.8p15/scripts/ntp-wait/ntp-wait-opts" (23 Jun 2020, 1652 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 "ntp-wait-opts": 4.2.8p14_vs_4.2.8p15.

    1 # EDIT THIS FILE WITH CAUTION  (ntp-wait-opts)
    2 #
    3 # It has been AutoGen-ed  June 23, 2020 at 02:21:30 AM by AutoGen 5.18.5
    4 # From the definitions    ntp-wait-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         'tries' => '100',
   33         'sleep' => '6',
   34         'verbose' => '',
   35         'help' => '', 'more-help' => ''
   36     };
   37     my $argument = '';
   38     my $ret = GetOptionsFromArray($args, $opts, (
   39         'tries|n=i', 'sleep|s=i', 'verbose|v',
   40         'help|?', 'more-help'));
   41 
   42     $usage = <<'USAGE';
   43 ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p15
   44 USAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
   45 
   46     -n, --tries=num              Number of times to check ntpd
   47     -s, --sleep=num              How long to sleep between tries
   48     -v, --verbose                Be verbose
   49     -?, --help                   Display usage information and exit
   50         --more-help              Pass the extended usage text through a pager
   51 
   52 Options are specified by doubled hyphens and their name or by a single
   53 hyphen and the flag character.
   54 USAGE
   55 
   56     usage(0)       if $opts->{'help'};
   57     paged_usage(0) if $opts->{'more-help'};
   58     $_[0] = $opts;
   59     return $ret;
   60 }
   61 
   62 END { close STDOUT };