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