]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Update to version 1.24.
authorJim Meyering <jim@meyering.net>
Sun, 24 Dec 2000 09:34:17 +0000 (09:34 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 24 Dec 2000 09:34:17 +0000 (09:34 +0000)
man/help2man

index d6f7a6567deb6fad88d23570ee29334018cd673e..e7441359c50ae154d52e4513578790d732160e2c 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.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} .= $_;