summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-12-24 09:34:17 +0000
committerJim Meyering <jim@meyering.net>2000-12-24 09:34:17 +0000
commit7862d9f6fcf14a67848a43e6c0a68d533f4eb36b (patch)
tree169de7f8f2786214ee07f5b7f60e5b2b631fa44e
parent7aa3fb3d47a8e97e45530e5069dbf4ce0b2e1bf9 (diff)
downloadcoreutils-7862d9f6fcf14a67848a43e6c0a68d533f4eb36b.tar.xz
Update to version 1.24.
-rwxr-xr-xman/help2man37
1 files changed, 25 insertions, 12 deletions
diff --git a/man/help2man b/man/help2man
index d6f7a6567..e7441359c 100755
--- a/man/help2man
+++ b/man/help2man
@@ -27,7 +27,7 @@ use Text::Tabs qw(expand);
use POSIX qw(strftime setlocale LC_TIME);
my $this_program = 'help2man';
-my $this_version = '1.23';
+my $this_version = '1.24';
my $version_info = <<EOT;
GNU $this_program $this_version
@@ -59,18 +59,20 @@ EOT
my $section = 1;
my ($opt_name, @opt_include, $opt_output, $opt_no_info);
-
-# Parse options.
-Getopt::Long::config('bundling');
-GetOptions (
+my %opt_def = (
'n|name=s' => \$opt_name,
's|section=s' => \$section,
'i|include=s' => sub { push @opt_include, [ pop, 1 ] },
'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] },
'o|output=s' => \$opt_output,
'N|no-info' => \$opt_no_info,
- help => sub { print $help_info; exit },
- version => sub { print $version_info; exit },
+);
+
+# Parse options.
+Getopt::Long::config('bundling');
+GetOptions (%opt_def,
+ help => sub { print $help_info; exit },
+ version => sub { print $version_info; exit },
) or die $help_info;
die $help_info unless @ARGV == 1;
@@ -93,9 +95,9 @@ BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 }
# verbatim text
#
-for (@opt_include)
+while (@opt_include)
{
- my ($inc, $required) = @$_;
+ my ($inc, $required) = @{shift @opt_include};
next unless -f $inc or $required;
die "$this_program: can't open `$inc' ($!)\n"
@@ -134,9 +136,20 @@ for (@opt_include)
next;
}
- # Silently ignore anything before the first
- # section--allows for comments and revision info.
- next unless $key;
+ # Check for options before the first section--anything else is
+ # silently ignored, allowing the first for comments and
+ # revision info.
+ unless ($key)
+ {
+ # handle options
+ if (/^-/)
+ {
+ local @ARGV = split;
+ GetOptions %opt_def;
+ }
+
+ next;
+ }
$hash->{$key} ||= '';
$hash->{$key} .= $_;