Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / bin / podselect
CommitLineData
920dae64
AT
1#!/import/archperf/ws/devtools/4/amd64/bin/perl
2 eval 'exec perl -S $0 "$@"'
3 if 0;
4
5#############################################################################
6# podselect -- command to invoke the podselect function in Pod::Select
7#
8# Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
9# This file is part of "PodParser". PodParser is free software;
10# you can redistribute it and/or modify it under the same terms
11# as Perl itself.
12#############################################################################
13
14use strict;
15use diagnostics;
16
17=head1 NAME
18
19podselect - print selected sections of pod documentation on standard output
20
21=head1 SYNOPSIS
22
23B<podselect> [B<-help>] [B<-man>] [B<-section>S< >I<section-spec>]
24[I<file>S< >...]
25
26=head1 OPTIONS AND ARGUMENTS
27
28=over 8
29
30=item B<-help>
31
32Print a brief help message and exit.
33
34=item B<-man>
35
36Print the manual page and exit.
37
38=item B<-section>S< >I<section-spec>
39
40Specify a section to include in the output.
41See L<Pod::Parser/"SECTION SPECIFICATIONS">
42for the format to use for I<section-spec>.
43This option may be given multiple times on the command line.
44
45=item I<file>
46
47The pathname of a file from which to select sections of pod
48documentation (defaults to standard input).
49
50=back
51
52=head1 DESCRIPTION
53
54B<podselect> will read the given input files looking for pod
55documentation and will print out (in raw pod format) all sections that
56match one ore more of the given section specifications. If no section
57specifications are given than all pod sections encountered are output.
58
59B<podselect> invokes the B<podselect()> function exported by B<Pod::Select>
60Please see L<Pod::Select/podselect()> for more details.
61
62=head1 SEE ALSO
63
64L<Pod::Parser> and L<Pod::Select>
65
66=head1 AUTHOR
67
68Please report bugs using L<http://rt.cpan.org>.
69
70Brad Appleton E<lt>bradapp@enteract.comE<gt>
71
72Based on code for B<Pod::Text::pod2text(1)> written by
73Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
74
75=cut
76
77use Pod::Select;
78use Pod::Usage;
79use Getopt::Long;
80
81## Define options
82my %options = (
83 "help" => 0,
84 "man" => 0,
85 "sections" => [],
86);
87
88## Parse options
89GetOptions(\%options, "help", "man", "sections|select=s@") || pod2usage(2);
90pod2usage(1) if ($options{help});
91pod2usage(-verbose => 2) if ($options{man});
92
93## Dont default to STDIN if connected to a terminal
94pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
95
96## Invoke podselect().
97if (@{ $options{"sections"} } > 0) {
98 podselect({ -sections => $options{"sections"} }, @ARGV);
99}
100else {
101 podselect(@ARGV);
102}
103
104