]> sjero.net Git - wget/blobdiff - doc/texi2pod.pl
Document exit codes.
[wget] / doc / texi2pod.pl
index 05d7d4be01d5dd65a35e7945bdc997542a6c18df..3fe0b8f12d7241133d5ff3d833370eb1b6793b88 100755 (executable)
@@ -1,12 +1,13 @@
 #! /usr/bin/env perl
 
-#   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+#   Copyright (C) 1999, 2000, 2001, 2003, 2007 Free Software
+#   Foundation, Inc.
 
 # This file is part of GCC.
 
 # GCC is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
+# the Free Software Foundation; either version 3, or (at your option)
 # any later version.
 
 # GCC is distributed in the hope that it will be useful,
@@ -15,9 +16,7 @@
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING.  If not, write to
-# the Free Software Foundation, 59 Temple Place - Suite 330,
-# Boston MA 02111-1307, USA.
+# along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 
 # This does trivial (and I mean _trivial_) conversion of Texinfo
 # markup to Perl POD format.  It's intended to be used to extract
@@ -229,11 +228,12 @@ while(<$inf>) {
     /^\@include\s+(.+)$/ and do {
        push @instack, $inf;
        $inf = gensym();
+       $file = postprocess($1);
 
        # Try cwd and $ibase.
-       open($inf, "<" . $1
-           or open($inf, "<" . $ibase . "/" . $1)
-               or die "cannot open $1 or $ibase/$1: $!\n";
+       open($inf, "<" . $file
+           or open($inf, "<" . $ibase . "/" . $file)
+               or die "cannot open $file or $ibase/$file: $!\n";
        next;
     };
 
@@ -276,7 +276,6 @@ while(<$inf>) {
        $ic =~ s/\@(?:code|kbd)/C/;
        $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
        $ic =~ s/\@(?:file)/F/;
-       $ic =~ s/\@(?:asis)/S/; # punt
        $_ = "\n=over 4\n";
     };
 
@@ -289,8 +288,13 @@ while(<$inf>) {
 
     /^\@itemx?\s*(.+)?$/ and do {
        if (defined $1) {
-           # Entity escapes prevent munging by the <> processing below.
-           $_ = "\n=item $ic\&LT;$1\&GT;\n";
+            my $thing = $1;
+            if ($ic =~ /\@asis/) {
+                $_ = "\n=item $thing\n";
+            } else {
+                # Entity escapes prevent munging by the <> processing below.
+                $_ = "\n=item $ic\&LT;$thing\&GT;\n";
+            }
        } else {
            $_ = "\n=item $ic\n";
            $ic =~ y/A-Ya-y/B-Zb-z/;
@@ -310,11 +314,12 @@ die "No filename or title\n" unless defined $fn && defined $tl;
 $sects{NAME} = "$fn \- $tl\n";
 $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
 
-for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXAMPLES FILES
-             BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
+for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXITSTATUS
+           FILES BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
     if(exists $sects{$sect}) {
        $head = $sect;
        $head =~ s/SEEALSO/SEE ALSO/;
+       $head =~ s/EXITSTATUS/EXIT STATUS/;
        print "=head1 $head\n\n";
        print scalar unmunge ($sects{$sect});
        print "\n";
@@ -352,6 +357,13 @@ sub postprocess
     s/\@w\{([^\}]*)\}/S<$1>/g;
     s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
 
+    # keep references of the form @ref{...}, print them bold
+    s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
+
+    # Change double single quotes to double quotes.
+    s/''/"/g;
+    s/``/"/g;
+
     # Cross references are thrown away, as are @noindent and @refill.
     # (@noindent is impossible in .pod, and @refill is unnecessary.)
     # @* is also impossible in .pod; we discard it and any newline that