]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
import 1.019
authorJim Meyering <jim@meyering.net>
Wed, 10 Nov 1999 06:14:12 +0000 (06:14 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 10 Nov 1999 06:14:12 +0000 (06:14 +0000)
man/help2man

index c3d80ea2dbe528c01bb6711160ba7a64411b6fbe..109547c551c49fb3952d678f55c45bd22e92648a 100755 (executable)
@@ -27,7 +27,7 @@ use Text::Tabs qw(expand);
 use POSIX qw(strftime setlocale LC_TIME);
 
 my $this_program = 'help2man';
-my $this_version = '1.018';
+my $this_version = '1.019';
 my $version_info = <<EOT;
 $this_program $this_version
 
@@ -78,7 +78,7 @@ my %append = ();
 my @include = (); # retain order given in include file
 
 # Provide replacement `quote-regex' operator for pre-5.005.
-BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 } 
+BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 }
 
 # Process include file (if given).  Format is:
 #
@@ -159,11 +159,10 @@ for my $hash (\(%include, %append))
 setlocale LC_TIME, 'C';
 
 # Grab help and version info from executable.
-my $help_text = join '', map { expand $_ } `$ARGV[0] --help 2>/dev/null`
-    or die "$this_program: can't get `--help' info from $ARGV[0]\n";
-
-my $version_text = join '', map { expand $_ } `$ARGV[0] --version 2>/dev/null`
-    or die "$this_program: can't get `--version' info from $ARGV[0]\n";
+my ($help_text, $version_text) = map {
+    join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null`
+       or die "$this_program: can't get `--$_' info from $ARGV[0]\n"
+} qw(help version);
 
 my $date = strftime "%B %Y", localtime;
 (my $program = $ARGV[0]) =~ s!.*/!!;
@@ -359,23 +358,28 @@ while (length)
     my $indent = 0;
     my $content = '';
 
-    # Tagged paragraph (option).
-    if (s/^( {1,10}(-\S+(?: \S+|(?:, *-\S+)*)))(?: +|\n( {20,}))(\S.*)\n//)
+    # Option with description.
+    if (s/^( {1,10}([+-]\S.*?))(?:(  +)|\n( {20,}))(\S.*)\n//)
     {
        $matched .= $& if %append;
-       $indent = length ($3 || $1);
-       my $tag = $2;
-       my $desc = $4;
-       unless ($3)
+       $indent = length ($4 || "$1$3");
+       $content = ".TP\n\x82$2\n\x82$5\n";
+       unless ($4)
        {
-           $indent = length $1;
-           $indent = length $1 if /^( {20,})[^\s-]/;
+           # Indent may be different on second line.
+           $indent = length $& if /^ {20,}/;
        }
+    }
 
-       $content = ".TP\n\x82$tag\n\x82$desc\n";
+    # Option without description.
+    elsif (s/^ {1,10}([+-]\S.*)\n//)
+    {
+       $matched .= $& if %append;
+       $content = ".HP\n\x82$1\n";
+       $indent = 80; # not continued
     }
 
-    # Tagged paragraph (other).
+    # Indented paragraph with tag.
     elsif (s/^( +(\S.*?)  +)(\S.*)\n//)
     {
        $matched .= $& if %append;