1275970Scy# EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
2275970Scy#
3310419Sdelphij# It has been AutoGen-ed  November 21, 2016 at 07:59:22 AM by AutoGen 5.18.5
4275970Scy# From the definitions    plot_summary-opts.def
5275970Scy# and the template file   perlopt
6275970Scy
7275970Scyuse Getopt::Long qw(GetOptionsFromArray);
8275970ScyGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
9275970Scy
10275970Scymy $usage;
11275970Scy
12275970Scysub usage {
13275970Scy    my ($ret) = @_;
14275970Scy    print STDERR $usage;
15275970Scy    exit $ret;
16275970Scy}
17275970Scy
18275970Scysub paged_usage {
19275970Scy    my ($ret) = @_;
20275970Scy    my $pager = $ENV{PAGER} || '(less || more)';
21275970Scy
22275970Scy    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
23275970Scy    print $usage;
24275970Scy
25275970Scy    exit $ret;
26275970Scy}
27275970Scy
28275970Scysub processOptions {
29275970Scy    my $args = shift;
30275970Scy
31275970Scy    my $opts = {
32275970Scy        'directory' => '/tmp',
33275970Scy        'identifier' => '',
34275970Scy        'offset-limit' => '0.128',
35275970Scy        'peer' => [],
36275970Scy        'plot-term' => '',
37275970Scy        'output-file' => '',
38275970Scy        'dont-wait' => '',
39275970Scy        'help' => '', 'more-help' => ''
40275970Scy    };
41275970Scy    my $argument = '';
42275970Scy    my $ret = GetOptionsFromArray($args, $opts, (
43275970Scy        'directory=s', 'identifier=s', 'offset-limit=f',
44275970Scy        'peer=s', 'plot-term=s', 'output-file=s',
45275970Scy        'dont-wait',
46275970Scy        'help|?', 'more-help'));
47275970Scy
48275970Scy    $usage = <<'USAGE';
49310419Sdelphijplot_summary - plot statistics generated by summary script - Ver. 4.2.8p9
50275970ScyUSAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
51275970Scy
52275970Scy        --directory=str          Where the summary files are
53275970Scy        --identifier=str         Origin of the data
54275970Scy        --offset-limit=float     Limit of absolute offset
55275970Scy        --peer=str               Peers to generate plots for
56275970Scy                                   - may appear multiple times
57275970Scy        --plot-term=str          Gnuplot terminal
58275970Scy        --output-file=str        Output file
59275970Scy        --dont-wait              Don't wait for keystroke between plots
60275970Scy    -?, --help                   Display usage information and exit
61275970Scy        --more-help              Pass the extended usage text through a pager
62275970Scy
63275970ScyOptions are specified by doubled hyphens and their name or by a single
64275970Scyhyphen and the flag character.
65275970ScyUSAGE
66275970Scy
67275970Scy    usage(0)       if $opts->{'help'};
68275970Scy    paged_usage(0) if $opts->{'more-help'};
69275970Scy    $_[0] = $opts;
70275970Scy    return $ret;
71275970Scy}
72275970Scy
73275970ScyEND { close STDOUT };
74