xref: /netbsd-src/external/bsd/ntp/dist/scripts/plot_summary-opts (revision 6cf6fe02a981b55727c49c3d37b0d8191a98c0ee)
1
2# DO NOT EDIT THE FOLLOWING
3#
4# It's auto generated option handling code
5
6use Getopt::Long qw(GetOptionsFromArray);
7Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
8
9my $usage;
10
11sub usage {
12    my ($ret) = @_;
13    print STDERR $usage;
14    exit $ret;
15}
16
17sub paged_usage {
18    my ($ret) = @_;
19    my $pager = $ENV{PAGER} || '(less || more)';
20
21    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
22    print $usage;
23
24    exit $ret;
25}
26
27sub processOptions {
28    my $args = shift;
29
30    my $opts = {
31        'directory' => '/tmp',
32        'identifier' => '',
33        'offset-limit' => '0.128',
34        'peer' => [],
35        'plot-term' => '',
36        'output-file' => '',
37        'dont-wait' => '',
38        'help' => '', 'more-help' => ''
39    };
40    my $argument = '';
41    my $ret = GetOptionsFromArray($args, $opts, (
42        'directory=s', 'identifier=s', 'offset-limit=f',
43        'peer=s', 'plot-term=s', 'output-file=s',
44        'dont-wait',
45        'help|?', 'more-help'));
46
47    $usage = <<'USAGE';
48plot_summary - plot statistics generated by summary script
49USAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
50
51      , --directory=str          Where the summary files are
52      , --identifier=str         Origin of the data
53      , --offset-limit=float     Limit of absolute offset
54      , --peer=str               Peers to generate plots for
55                                   - may appear multiple times
56      , --plot-term=str          Gnuplot terminal
57      , --output-file=str        Output file
58      , --dont-wait              Don't wait for keystroke between plots
59    -?, --help                   Display usage information and exit
60      , --more-help              Pass the extended usage information through a pager
61
62Options are specified by doubled hyphens and their name or by a single
63hyphen and the flag character.
64USAGE
65
66    usage(0)       if $opts->{'help'};
67    paged_usage(0) if $opts->{'more-help'};
68    $_[0] = $opts;
69    return $ret;
70}
71
72END { close STDOUT };
73
74