xref: /netbsd-src/external/bsd/ntp/dist/scripts/summary-opts (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
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' => '/var/log/ntp',
32        'end-date' => '',
33        'output-directory' => '/tmp',
34        'peer-dist-limit' => '400',
35        'skip-time-steps' => '3600',
36        'start-date' => '19700101',
37        'help' => '', 'more-help' => ''
38    };
39    my $argument = '';
40    my $ret = GetOptionsFromArray($args, $opts, (
41        'directory=s', 'end-date=i', 'output-directory=s',
42        'peer-dist-limit=f', 'skip-time-steps=f', 'start-date=i',
43        'help|?', 'more-help'));
44
45    $usage = <<'USAGE';
46summary - compute various stastics from NTP stat files
47USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
48
49      , --directory=str          Directory containing stat files
50      , --end-date=num           End date
51      , --output-directory=str   Output directory
52      , --peer-dist-limit=float  Peer dist limit
53      , --skip-time-steps=float  Ignore time offsets larger that this
54      , --start-date=num         Start date
55    -?, --help                   Display usage information and exit
56      , --more-help              Pass the extended usage information through a pager
57
58Options are specified by doubled hyphens and their name or by a single
59hyphen and the flag character.
60USAGE
61
62    usage(0)       if $opts->{'help'};
63    paged_usage(0) if $opts->{'more-help'};
64    $_[0] = $opts;
65    return $ret;
66}
67
68END { close STDOUT };
69
70