xref: /freebsd/contrib/ntp/scripts/plot_summary-opts (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
22b15cb3dSCy Schubert#
3*f5f40dd6SCy Schubert# It has been AutoGen-ed  May 25, 2024 at 12:05:57 AM by AutoGen 5.18.16
42b15cb3dSCy Schubert# From the definitions    plot_summary-opts.def
52b15cb3dSCy Schubert# and the template file   perlopt
62b15cb3dSCy Schubert
72b15cb3dSCy Schubertuse Getopt::Long qw(GetOptionsFromArray);
82b15cb3dSCy SchubertGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
92b15cb3dSCy Schubert
102b15cb3dSCy Schubertmy $usage;
112b15cb3dSCy Schubert
122b15cb3dSCy Schubertsub usage {
132b15cb3dSCy Schubert    my ($ret) = @_;
142b15cb3dSCy Schubert    print STDERR $usage;
152b15cb3dSCy Schubert    exit $ret;
162b15cb3dSCy Schubert}
172b15cb3dSCy Schubert
182b15cb3dSCy Schubertsub paged_usage {
192b15cb3dSCy Schubert    my ($ret) = @_;
202b15cb3dSCy Schubert    my $pager = $ENV{PAGER} || '(less || more)';
212b15cb3dSCy Schubert
222b15cb3dSCy Schubert    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
232b15cb3dSCy Schubert    print $usage;
242b15cb3dSCy Schubert
252b15cb3dSCy Schubert    exit $ret;
262b15cb3dSCy Schubert}
272b15cb3dSCy Schubert
282b15cb3dSCy Schubertsub processOptions {
292b15cb3dSCy Schubert    my $args = shift;
302b15cb3dSCy Schubert
312b15cb3dSCy Schubert    my $opts = {
322b15cb3dSCy Schubert        'directory' => '/tmp',
332b15cb3dSCy Schubert        'identifier' => '',
342b15cb3dSCy Schubert        'offset-limit' => '0.128',
352b15cb3dSCy Schubert        'peer' => [],
362b15cb3dSCy Schubert        'plot-term' => '',
372b15cb3dSCy Schubert        'output-file' => '',
382b15cb3dSCy Schubert        'dont-wait' => '',
392b15cb3dSCy Schubert        'help' => '', 'more-help' => ''
402b15cb3dSCy Schubert    };
412b15cb3dSCy Schubert    my $argument = '';
422b15cb3dSCy Schubert    my $ret = GetOptionsFromArray($args, $opts, (
432b15cb3dSCy Schubert        'directory=s', 'identifier=s', 'offset-limit=f',
442b15cb3dSCy Schubert        'peer=s', 'plot-term=s', 'output-file=s',
452b15cb3dSCy Schubert        'dont-wait',
462b15cb3dSCy Schubert        'help|?', 'more-help'));
472b15cb3dSCy Schubert
482b15cb3dSCy Schubert    $usage = <<'USAGE';
49*f5f40dd6SCy Schubertplot_summary - plot statistics generated by summary script - Ver. 4.2.8p18
502b15cb3dSCy SchubertUSAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
512b15cb3dSCy Schubert
522b15cb3dSCy Schubert        --directory=str          Where the summary files are
532b15cb3dSCy Schubert        --identifier=str         Origin of the data
542b15cb3dSCy Schubert        --offset-limit=float     Limit of absolute offset
552b15cb3dSCy Schubert        --peer=str               Peers to generate plots for
562b15cb3dSCy Schubert                                   - may appear multiple times
572b15cb3dSCy Schubert        --plot-term=str          Gnuplot terminal
582b15cb3dSCy Schubert        --output-file=str        Output file
592b15cb3dSCy Schubert        --dont-wait              Don't wait for keystroke between plots
602b15cb3dSCy Schubert    -?, --help                   Display usage information and exit
612b15cb3dSCy Schubert        --more-help              Pass the extended usage text through a pager
622b15cb3dSCy Schubert
632b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single
642b15cb3dSCy Schuberthyphen and the flag character.
652b15cb3dSCy SchubertUSAGE
662b15cb3dSCy Schubert
672b15cb3dSCy Schubert    usage(0)       if $opts->{'help'};
682b15cb3dSCy Schubert    paged_usage(0) if $opts->{'more-help'};
692b15cb3dSCy Schubert    $_[0] = $opts;
702b15cb3dSCy Schubert    return $ret;
712b15cb3dSCy Schubert}
722b15cb3dSCy Schubert
732b15cb3dSCy SchubertEND { close STDOUT };
74