xref: /netbsd-src/external/bsd/ntp/dist/scripts/plot_summary-opts (revision 897be3a4bac39d8b2e92077bf29f4a2e67d31983)
1b8ecfcfeSchristos# EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
28585484eSchristos#
3*897be3a4Schristos# It has been AutoGen-ed  May 25, 2024 at 12:05:57 AM by AutoGen 5.18.16
4b8ecfcfeSchristos# From the definitions    plot_summary-opts.def
5b8ecfcfeSchristos# and the template file   perlopt
68585484eSchristos
78585484eSchristosuse Getopt::Long qw(GetOptionsFromArray);
88585484eSchristosGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
98585484eSchristos
108585484eSchristosmy $usage;
118585484eSchristos
128585484eSchristossub usage {
138585484eSchristos    my ($ret) = @_;
148585484eSchristos    print STDERR $usage;
158585484eSchristos    exit $ret;
168585484eSchristos}
178585484eSchristos
188585484eSchristossub paged_usage {
198585484eSchristos    my ($ret) = @_;
208585484eSchristos    my $pager = $ENV{PAGER} || '(less || more)';
218585484eSchristos
228585484eSchristos    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
238585484eSchristos    print $usage;
248585484eSchristos
258585484eSchristos    exit $ret;
268585484eSchristos}
278585484eSchristos
288585484eSchristossub processOptions {
298585484eSchristos    my $args = shift;
308585484eSchristos
318585484eSchristos    my $opts = {
328585484eSchristos        'directory' => '/tmp',
338585484eSchristos        'identifier' => '',
348585484eSchristos        'offset-limit' => '0.128',
358585484eSchristos        'peer' => [],
368585484eSchristos        'plot-term' => '',
378585484eSchristos        'output-file' => '',
388585484eSchristos        'dont-wait' => '',
398585484eSchristos        'help' => '', 'more-help' => ''
408585484eSchristos    };
418585484eSchristos    my $argument = '';
428585484eSchristos    my $ret = GetOptionsFromArray($args, $opts, (
438585484eSchristos        'directory=s', 'identifier=s', 'offset-limit=f',
448585484eSchristos        'peer=s', 'plot-term=s', 'output-file=s',
458585484eSchristos        'dont-wait',
468585484eSchristos        'help|?', 'more-help'));
478585484eSchristos
488585484eSchristos    $usage = <<'USAGE';
49*897be3a4Schristosplot_summary - plot statistics generated by summary script - Ver. 4.2.8p18
508585484eSchristosUSAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
518585484eSchristos
52b8ecfcfeSchristos        --directory=str          Where the summary files are
53b8ecfcfeSchristos        --identifier=str         Origin of the data
54b8ecfcfeSchristos        --offset-limit=float     Limit of absolute offset
55b8ecfcfeSchristos        --peer=str               Peers to generate plots for
568585484eSchristos                                   - may appear multiple times
57b8ecfcfeSchristos        --plot-term=str          Gnuplot terminal
58b8ecfcfeSchristos        --output-file=str        Output file
59b8ecfcfeSchristos        --dont-wait              Don't wait for keystroke between plots
608585484eSchristos    -?, --help                   Display usage information and exit
61b8ecfcfeSchristos        --more-help              Pass the extended usage text through a pager
628585484eSchristos
638585484eSchristosOptions are specified by doubled hyphens and their name or by a single
648585484eSchristoshyphen and the flag character.
658585484eSchristosUSAGE
668585484eSchristos
678585484eSchristos    usage(0)       if $opts->{'help'};
688585484eSchristos    paged_usage(0) if $opts->{'more-help'};
698585484eSchristos    $_[0] = $opts;
708585484eSchristos    return $ret;
718585484eSchristos}
728585484eSchristos
738585484eSchristosEND { close STDOUT };
74