1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-05 16:19:23 +02:00

import 1.019

This commit is contained in:
Jim Meyering
1999-11-10 06:14:12 +00:00
parent baee6fd135
commit c4d7026cf9
+22 -18
View File
@@ -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";
}
# Tagged paragraph (other).
# Option without description.
elsif (s/^ {1,10}([+-]\S.*)\n//)
{
$matched .= $& if %append;
$content = ".HP\n\x82$1\n";
$indent = 80; # not continued
}
# Indented paragraph with tag.
elsif (s/^( +(\S.*?) +)(\S.*)\n//)
{
$matched .= $& if %append;