summary-opts revision 1.1.1.1.4.2 1 1.1.1.1.4.2 yamt
2 1.1.1.1.4.2 yamt # DO NOT EDIT THE FOLLOWING
3 1.1.1.1.4.2 yamt #
4 1.1.1.1.4.2 yamt # It's auto generated option handling code
5 1.1.1.1.4.2 yamt
6 1.1.1.1.4.2 yamt use Getopt::Long qw(GetOptionsFromArray);
7 1.1.1.1.4.2 yamt Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
8 1.1.1.1.4.2 yamt
9 1.1.1.1.4.2 yamt my $usage;
10 1.1.1.1.4.2 yamt
11 1.1.1.1.4.2 yamt sub usage {
12 1.1.1.1.4.2 yamt my ($ret) = @_;
13 1.1.1.1.4.2 yamt print STDERR $usage;
14 1.1.1.1.4.2 yamt exit $ret;
15 1.1.1.1.4.2 yamt }
16 1.1.1.1.4.2 yamt
17 1.1.1.1.4.2 yamt sub paged_usage {
18 1.1.1.1.4.2 yamt my ($ret) = @_;
19 1.1.1.1.4.2 yamt my $pager = $ENV{PAGER} || '(less || more)';
20 1.1.1.1.4.2 yamt
21 1.1.1.1.4.2 yamt open STDOUT, "| $pager" or die "Can't fork a pager: $!";
22 1.1.1.1.4.2 yamt print $usage;
23 1.1.1.1.4.2 yamt
24 1.1.1.1.4.2 yamt exit $ret;
25 1.1.1.1.4.2 yamt }
26 1.1.1.1.4.2 yamt
27 1.1.1.1.4.2 yamt sub processOptions {
28 1.1.1.1.4.2 yamt my $args = shift;
29 1.1.1.1.4.2 yamt
30 1.1.1.1.4.2 yamt my $opts = {
31 1.1.1.1.4.2 yamt 'directory' => '/var/log/ntp',
32 1.1.1.1.4.2 yamt 'end-date' => '',
33 1.1.1.1.4.2 yamt 'output-directory' => '/tmp',
34 1.1.1.1.4.2 yamt 'peer-dist-limit' => '400',
35 1.1.1.1.4.2 yamt 'skip-time-steps' => '3600',
36 1.1.1.1.4.2 yamt 'start-date' => '19700101',
37 1.1.1.1.4.2 yamt 'help' => '', 'more-help' => ''
38 1.1.1.1.4.2 yamt };
39 1.1.1.1.4.2 yamt my $argument = '';
40 1.1.1.1.4.2 yamt my $ret = GetOptionsFromArray($args, $opts, (
41 1.1.1.1.4.2 yamt 'directory=s', 'end-date=i', 'output-directory=s',
42 1.1.1.1.4.2 yamt 'peer-dist-limit=f', 'skip-time-steps=f', 'start-date=i',
43 1.1.1.1.4.2 yamt 'help|?', 'more-help'));
44 1.1.1.1.4.2 yamt
45 1.1.1.1.4.2 yamt $usage = <<'USAGE';
46 1.1.1.1.4.2 yamt summary - compute various stastics from NTP stat files
47 1.1.1.1.4.2 yamt USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
48 1.1.1.1.4.2 yamt
49 1.1.1.1.4.2 yamt , --directory=str Directory containing stat files
50 1.1.1.1.4.2 yamt , --end-date=num End date
51 1.1.1.1.4.2 yamt , --output-directory=str Output directory
52 1.1.1.1.4.2 yamt , --peer-dist-limit=float Peer dist limit
53 1.1.1.1.4.2 yamt , --skip-time-steps=float Ignore time offsets larger that this
54 1.1.1.1.4.2 yamt , --start-date=num Start date
55 1.1.1.1.4.2 yamt -?, --help Display usage information and exit
56 1.1.1.1.4.2 yamt , --more-help Pass the extended usage information through a pager
57 1.1.1.1.4.2 yamt
58 1.1.1.1.4.2 yamt Options are specified by doubled hyphens and their name or by a single
59 1.1.1.1.4.2 yamt hyphen and the flag character.
60 1.1.1.1.4.2 yamt USAGE
61 1.1.1.1.4.2 yamt
62 1.1.1.1.4.2 yamt usage(0) if $opts->{'help'};
63 1.1.1.1.4.2 yamt paged_usage(0) if $opts->{'more-help'};
64 1.1.1.1.4.2 yamt $_[0] = $opts;
65 1.1.1.1.4.2 yamt return $ret;
66 1.1.1.1.4.2 yamt }
67 1.1.1.1.4.2 yamt
68 1.1.1.1.4.2 yamt END { close STDOUT };
69 1.1.1.1.4.2 yamt
70