[win32] the EXTCONST in sdbm.h breaks SDBM on Borland, since
[p5sagit/p5-mst-13.2.git] / pod / pod2man.PL
index 79e3edd..5e5dfb0 100644 (file)
@@ -310,11 +310,12 @@ Tom Christiansen such that Larry probably doesn't recognize it anymore.
 
 $/ = "";
 $cutting = 1;
+@Indices = ();
 
 # We try first to get the version number from a local binary, in case we're
 # running an installed version of Perl to produce documentation from an
 # uninstalled newer version's pod files.
-if ($^O ne 'plan9') {
+if ($^O ne 'plan9' && $^O ne 'dos') {
   ($version,$patch) =
     `\PATH=.:..:\$PATH; perl -v` =~ /version (\d\.\d{3})(?:_(\d{2}))?/;
 }
@@ -555,13 +556,14 @@ END
 
 print <<"END";
 .TH $name $section "$RP" "$date" "$center"
-.IX Title "$name $section"
 .UC
 END
 
+push(@Indices, qq{.IX Title "$name $section"});
+
 while (($name, $desc) = each %namedesc) {
     for ($name, $desc) { s/^\s+//; s/\s+$//; }
-    print qq(.IX Name "$name - $desc"\n);
+    push(@Indices, qq(.IX Name "$name - $desc"\n));
 }
 
 print <<'END';
@@ -799,6 +801,9 @@ while (<>) {
        # no break -- usually we want C<> for this
        s/S<([^<>]*)>/nobreak($1)/eg;
 
+       # LREF: a la HREF L<show this text|man/section>
+       s:L<([^|>]+)\|[^>]+>:$1:g;
+
        # LREF: a manpage(3f)
        s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g;
 
@@ -883,11 +888,11 @@ while (<>) {
            s/\s+$//;
            delete $wanna_see{$_} if exists $wanna_see{$_};
            print qq{.SH "$_"\n};
-           print qq{.IX Header "$_"\n};
+      push(@Indices, qq{.IX Header "$_"\n});
        }
        elsif ($Cmd eq 'head2') {
            print qq{.Sh "$_"\n};
-           print qq{.IX Subsection "$_"\n};
+      push(@Indices, qq{.IX Subsection "$_"\n});
        }
        elsif ($Cmd eq 'over') {
            push(@indent,$indent);
@@ -906,7 +911,7 @@ while (<>) {
            s/[^"]""([^"]+?)""[^"]/'$1'/g;
            # here do something about the $" in perlvar?
            print STDOUT qq{.Ip "$_" $indent\n};
-           print qq{.IX Item "$_"\n};
+      push(@Indices, qq{.IX Item "$_"\n});
        }
        elsif ($Cmd eq 'pod') {
            # this is just a comment
@@ -939,6 +944,8 @@ if (%wanna_see && !$lax) {
     $oops++;
 }
 
+foreach (@Indices) { print "$_\n"; }
+
 exit;
 #exit ($oops != 0);
 
@@ -1042,7 +1049,7 @@ sub makespace {
 sub mkindex {
     my ($entry) = @_;
     my @entries = split m:\s*/\s*:, $entry;
-    print ".IX Xref ";
+    push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries;
     for $entry (@entries) {
        print qq("$entry" );
     }