plot_summary-opts revision 301256
159109Sarchie# EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
259109Sarchie#
359109Sarchie# It has been AutoGen-ed  June  2, 2016 at 07:25:41 AM by AutoGen 5.18.5
459109Sarchie# From the definitions    plot_summary-opts.def
559109Sarchie# and the template file   perlopt
659109Sarchie
759109Sarchieuse Getopt::Long qw(GetOptionsFromArray);
859109SarchieGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
959109Sarchie
1059109Sarchiemy $usage;
1159109Sarchie
1259109Sarchiesub usage {
1359109Sarchie    my ($ret) = @_;
1459109Sarchie    print STDERR $usage;
1559109Sarchie    exit $ret;
1659109Sarchie}
1759109Sarchie
1859109Sarchiesub paged_usage {
1959109Sarchie    my ($ret) = @_;
2059109Sarchie    my $pager = $ENV{PAGER} || '(less || more)';
2159109Sarchie
2259109Sarchie    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
2359109Sarchie    print $usage;
2459109Sarchie
2559109Sarchie    exit $ret;
2659109Sarchie}
2759109Sarchie
2859109Sarchiesub processOptions {
2959109Sarchie    my $args = shift;
3059109Sarchie
3159109Sarchie    my $opts = {
3259109Sarchie        'directory' => '/tmp',
3359109Sarchie        'identifier' => '',
3459109Sarchie        'offset-limit' => '0.128',
3559109Sarchie        'peer' => [],
3659109Sarchie        'plot-term' => '',
3767506Sjulian        'output-file' => '',
3859109Sarchie        'dont-wait' => '',
3959109Sarchie        'help' => '', 'more-help' => ''
4059109Sarchie    };
4159109Sarchie    my $argument = '';
4259109Sarchie    my $ret = GetOptionsFromArray($args, $opts, (
4359109Sarchie        'directory=s', 'identifier=s', 'offset-limit=f',
4459109Sarchie        'peer=s', 'plot-term=s', 'output-file=s',
4559109Sarchie        'dont-wait',
4659109Sarchie        'help|?', 'more-help'));
4759109Sarchie
4859109Sarchie    $usage = <<'USAGE';
4959109Sarchieplot_summary - plot statistics generated by summary script - Ver. 4.2.8p8
5059109SarchieUSAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
5159109Sarchie
5259109Sarchie        --directory=str          Where the summary files are
5359109Sarchie        --identifier=str         Origin of the data
5459109Sarchie        --offset-limit=float     Limit of absolute offset
5559109Sarchie        --peer=str               Peers to generate plots for
5659109Sarchie                                   - may appear multiple times
5759109Sarchie        --plot-term=str          Gnuplot terminal
5859109Sarchie        --output-file=str        Output file
5959109Sarchie        --dont-wait              Don't wait for keystroke between plots
6059109Sarchie    -?, --help                   Display usage information and exit
6159109Sarchie        --more-help              Pass the extended usage text through a pager
6259109Sarchie
6359109SarchieOptions are specified by doubled hyphens and their name or by a single
6459109Sarchiehyphen and the flag character.
6559109SarchieUSAGE
6659109Sarchie
6759109Sarchie    usage(0)       if $opts->{'help'};
6870870Sjulian    paged_usage(0) if $opts->{'more-help'};
6970870Sjulian    $_[0] = $opts;
7070870Sjulian    return $ret;
7170870Sjulian}
7270870Sjulian
7370870SjulianEND { close STDOUT };
7459109Sarchie