xref: /freebsd/contrib/ntp/scripts/plot_summary-opts (revision 2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f)
1*2b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
2*2b15cb3dSCy Schubert#
3*2b15cb3dSCy Schubert# It has been AutoGen-ed  February  4, 2015 at 02:37:49 AM by AutoGen 5.18.5pre4
4*2b15cb3dSCy Schubert# From the definitions    plot_summary-opts.def
5*2b15cb3dSCy Schubert# and the template file   perlopt
6*2b15cb3dSCy Schubert
7*2b15cb3dSCy Schubertuse Getopt::Long qw(GetOptionsFromArray);
8*2b15cb3dSCy SchubertGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9*2b15cb3dSCy Schubert
10*2b15cb3dSCy Schubertmy $usage;
11*2b15cb3dSCy Schubert
12*2b15cb3dSCy Schubertsub usage {
13*2b15cb3dSCy Schubert    my ($ret) = @_;
14*2b15cb3dSCy Schubert    print STDERR $usage;
15*2b15cb3dSCy Schubert    exit $ret;
16*2b15cb3dSCy Schubert}
17*2b15cb3dSCy Schubert
18*2b15cb3dSCy Schubertsub paged_usage {
19*2b15cb3dSCy Schubert    my ($ret) = @_;
20*2b15cb3dSCy Schubert    my $pager = $ENV{PAGER} || '(less || more)';
21*2b15cb3dSCy Schubert
22*2b15cb3dSCy Schubert    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
23*2b15cb3dSCy Schubert    print $usage;
24*2b15cb3dSCy Schubert
25*2b15cb3dSCy Schubert    exit $ret;
26*2b15cb3dSCy Schubert}
27*2b15cb3dSCy Schubert
28*2b15cb3dSCy Schubertsub processOptions {
29*2b15cb3dSCy Schubert    my $args = shift;
30*2b15cb3dSCy Schubert
31*2b15cb3dSCy Schubert    my $opts = {
32*2b15cb3dSCy Schubert        'directory' => '/tmp',
33*2b15cb3dSCy Schubert        'identifier' => '',
34*2b15cb3dSCy Schubert        'offset-limit' => '0.128',
35*2b15cb3dSCy Schubert        'peer' => [],
36*2b15cb3dSCy Schubert        'plot-term' => '',
37*2b15cb3dSCy Schubert        'output-file' => '',
38*2b15cb3dSCy Schubert        'dont-wait' => '',
39*2b15cb3dSCy Schubert        'help' => '', 'more-help' => ''
40*2b15cb3dSCy Schubert    };
41*2b15cb3dSCy Schubert    my $argument = '';
42*2b15cb3dSCy Schubert    my $ret = GetOptionsFromArray($args, $opts, (
43*2b15cb3dSCy Schubert        'directory=s', 'identifier=s', 'offset-limit=f',
44*2b15cb3dSCy Schubert        'peer=s', 'plot-term=s', 'output-file=s',
45*2b15cb3dSCy Schubert        'dont-wait',
46*2b15cb3dSCy Schubert        'help|?', 'more-help'));
47*2b15cb3dSCy Schubert
48*2b15cb3dSCy Schubert    $usage = <<'USAGE';
49*2b15cb3dSCy Schubertplot_summary - plot statistics generated by summary script - Ver. 4.2.8p1
50*2b15cb3dSCy SchubertUSAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
51*2b15cb3dSCy Schubert
52*2b15cb3dSCy Schubert        --directory=str          Where the summary files are
53*2b15cb3dSCy Schubert        --identifier=str         Origin of the data
54*2b15cb3dSCy Schubert        --offset-limit=float     Limit of absolute offset
55*2b15cb3dSCy Schubert        --peer=str               Peers to generate plots for
56*2b15cb3dSCy Schubert                                   - may appear multiple times
57*2b15cb3dSCy Schubert        --plot-term=str          Gnuplot terminal
58*2b15cb3dSCy Schubert        --output-file=str        Output file
59*2b15cb3dSCy Schubert        --dont-wait              Don't wait for keystroke between plots
60*2b15cb3dSCy Schubert    -?, --help                   Display usage information and exit
61*2b15cb3dSCy Schubert        --more-help              Pass the extended usage text through a pager
62*2b15cb3dSCy Schubert
63*2b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single
64*2b15cb3dSCy Schuberthyphen and the flag character.
65*2b15cb3dSCy SchubertUSAGE
66*2b15cb3dSCy Schubert
67*2b15cb3dSCy Schubert    usage(0)       if $opts->{'help'};
68*2b15cb3dSCy Schubert    paged_usage(0) if $opts->{'more-help'};
69*2b15cb3dSCy Schubert    $_[0] = $opts;
70*2b15cb3dSCy Schubert    return $ret;
71*2b15cb3dSCy Schubert}
72*2b15cb3dSCy Schubert
73*2b15cb3dSCy SchubertEND { close STDOUT };
74