Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / bin / pod2usage
CommitLineData
86530b38
AT
1#!/import/bw/tools/local/perl-5.8.0/bin/perl
2 eval 'exec perl -S $0 "$@"'
3 if 0;
4
5#############################################################################
6# pod2usage -- command to print usage messages from embedded pod docs
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
19pod2usage - print usage messages from embedded pod docs in files
20
21=head1 SYNOPSIS
22
23=over 12
24
25=item B<pod2usage>
26
27[B<-help>]
28[B<-man>]
29[B<-exit>S< >I<exitval>]
30[B<-output>S< >I<outfile>]
31[B<-verbose> I<level>]
32[B<-pathlist> I<dirlist>]
33I<file>
34
35=back
36
37=head1 OPTIONS AND ARGUMENTS
38
39=over 8
40
41=item B<-help>
42
43Print a brief help message and exit.
44
45=item B<-man>
46
47Print this command's manual page and exit.
48
49=item B<-exit> I<exitval>
50
51The exit status value to return.
52
53=item B<-output> I<outfile>
54
55The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
56are used then standard output is used. If ">&2" or ">&STDERR" is used then
57standard error is used.
58
59=item B<-verbose> I<level>
60
61The desired level of verbosity to use:
62
63 1 : print SYNOPSIS only
64 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
65 3 : print the entire manpage (similar to running pod2text)
66
67=item B<-pathlist> I<dirlist>
68
69Specifies one or more directories to search for the input file if it
70was not supplied with an absolute path. Each directory path in the given
71list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
72
73=item I<file>
74
75The pathname of a file containing pod documentation to be output in
76usage mesage format (defaults to standard input).
77
78=back
79
80=head1 DESCRIPTION
81
82B<pod2usage> will read the given input file looking for pod
83documentation and will print the corresponding usage message.
84If no input file is specifed than standard input is read.
85
86B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
87module. Please see L<Pod::Usage/pod2usage()>.
88
89=head1 SEE ALSO
90
91L<Pod::Usage>, L<pod2text(1)>
92
93=head1 AUTHOR
94
95Brad Appleton E<lt>bradapp@enteract.comE<gt>
96
97Based on code for B<pod2text(1)> written by
98Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
99
100=cut
101
102use Pod::Usage;
103use Getopt::Long;
104
105## Define options
106my %options = ();
107my @opt_specs = (
108 "help",
109 "man",
110 "exit=i",
111 "output=s",
112 "pathlist=s",
113 "verbose=i",
114);
115
116## Parse options
117GetOptions(\%options, @opt_specs) || pod2usage(2);
118pod2usage(1) if ($options{help});
119pod2usage(VERBOSE => 2) if ($options{man});
120
121## Dont default to STDIN if connected to a terminal
122pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
123
124@ARGV = ("-") unless (@ARGV > 0);
125if (@ARGV > 1) {
126 print STDERR "pod2usage: Too many filenames given\n\n";
127 pod2usage(2);
128}
129
130my %usage = ();
131$usage{-input} = shift(@ARGV);
132$usage{-exitval} = $options{"exit"} if (defined $options{"exit"});
133$usage{-output} = $options{"output"} if (defined $options{"output"});
134$usage{-verbose} = $options{"verbose"} if (defined $options{"verbose"});
135$usage{-pathlist} = $options{"pathlist"} if (defined $options{"pathlist"});
136
137pod2usage(\%usage);
138
139