From 7862d9f6fcf14a67848a43e6c0a68d533f4eb36b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Dec 2000 09:34:17 +0000 Subject: Update to version 1.24. --- man/help2man | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'man') 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 = < \$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} .= $_; -- cgit v1.2.3-54-g00ecf