diff --git a/ChangeLog b/ChangeLog
index d9b3411..f0afc7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Fri Dec 22 23:17:11 2000 Brendan O'Dea <bod@compusol.com.au>
+
+ * help2man.PL: Process options given in the block before the first
+ section of an include file (suggested by Akim Demaille).
+
+ * help2man.aux: Document option parsing of initial include file
+ segment.
+
+ * help2man.texi: Use @pxref rather than @xref (Karl Berry).
+ Document option parsing of initial include file segment.
+
Tue Oct 31 17:07:30 2000 Brendan O'Dea <bod@compusol.com.au>
* help2man.PL: Add protection for leading apostrophes (reported by
diff --git a/NEWS b/NEWS
index 96ad3e6..17de795 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Version 1.24 December 22, 2000
+
+ * Allow options to be specified in the initial block of include files.
+
Version 1.23 October 31, 2000
* Escape leading apostrophes.
diff --git a/README b/README
index 53ee070..bfb77ce 100644
--- a/README
+++ b/README
@@ -1,12 +1,12 @@
README for GNU help2man
- version 1.23
- October 31, 2000
+ version 1.24
+ December 22, 2000
help2man is a script to create simple man pages from the --help and
--version output of programs.
http://www.gnu.org/software/help2man/
- ftp://ftp.gnu.org/gnu/help2man/help2man-1.23.tar.gz
+ ftp://ftp.gnu.org/gnu/help2man/help2man-1.24.tar.gz
Since most GNU documentation is now in info format, this provides a
way to generate a placeholder man page pointing to that resource while
diff --git a/help2man.PL b/help2man.PL
index 34c4fd3..e09eb25 100755
--- a/help2man.PL
+++ b/help2man.PL
@@ -16,7 +16,7 @@ use Config;
use Getopt::Long;
my ($program, $version)
- = (qw$Id: help2man.PL,v 1.23 2000/10/31 06:07:30 bod Exp $)[1..2];
+ = (qw$Id: help2man.PL,v 1.24 2000/12/22 12:17:11 bod Exp $)[1..2];
$program =~ s/\.PL(,v)?$//;
@@ -125,18 +125,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;
@@ -159,9 +161,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"
@@ -200,9 +202,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} .= $_;
diff --git a/help2man.aux b/help2man.aux
index b4f5dee..6537105 100644
--- a/help2man.aux
+++ b/help2man.aux
@@ -1,6 +1,6 @@
Include file for help2man man page
-$Id: help2man.aux,v 1.5 2000/07/07 06:13:21 bod Exp $
+$Id: help2man.aux,v 1.6 2000/12/22 12:17:00 bod Exp $
[name]
help2man \- generate a simple manual page
@@ -33,8 +33,9 @@ or
modifiers (see
.BR perlre (1)).
-Anything before the first section or pattern is silently ignored and
-may be used for comments, RCS keywords and the like.
+Lines before the first section or pattern which begin with `\-' are
+processed as options. Anything else is silently ignored and may be
+used for comments, RCS keywords and the like.
The section output order is:
diff --git a/help2man.info b/help2man.info
index e173232..220ca43 100644
--- a/help2man.info
+++ b/help2man.info
@@ -83,8 +83,8 @@ How to Run `help2man'.
By default (for want of anything better) this paragraph contains
`manual page for PROGRAM VERSION'.
- This option overrides an include file `[name]' section (*Note
- Including text::).
+ This option overrides an include file `[name]' section (*note
+ Including text::.).
`--section SECTION'
`-s SECTION'
@@ -93,7 +93,7 @@ How to Run `help2man'.
`--include FILE'
`-i FILE'
- Include material from FILE (*Note Including text::).
+ Include material from FILE (*note Including text::.).
`--opt-include FILE'
`-I FILE'
@@ -120,8 +120,8 @@ Including Additional Text in the Output
***************************************
Additional static text may be included in the generated manual page
-by using the `--include' and `--opt-include' options (*Note Invoking
-help2man::).
+by using the `--include' and `--opt-include' options (*note Invoking
+help2man::.).
The format for files included with these option is simple:
@@ -138,8 +138,9 @@ paragraph matching `/pattern/'.
Patterns use the Perl regular expression syntax and may be followed
by the `i', `s' or `m' modifiers (*note perlre(1): (*manpages*)perlre.)
- Anything before the first section or pattern is silently ignored and
-may be used for comments, RCS keywords and the like.
+ Lines before the first section or pattern which begin with `-' are
+processed as options. Anything else is silently ignored and may be
+used for comments, RCS keywords and the like.
The section output order is:
@@ -216,9 +217,9 @@ Tag Table:
Node: Top1100
Node: Overview1664
Node: Invoking help2man2370
-Node: Including text3574
-Node: Makefile usage5048
-Node: Reports5966
-Node: Availability6241
+Node: Including text3576
+Node: Makefile usage5110
+Node: Reports6028
+Node: Availability6303
End Tag Table
diff --git a/help2man.texi b/help2man.texi
index 4b745be..f6e780d 100644
--- a/help2man.texi
+++ b/help2man.texi
@@ -5,7 +5,7 @@
@setchapternewpage odd
@finalout
@c %**end of header
-@c $Id: help2man.texi,v 1.4 2000/07/07 06:15:03 bod Exp $
+@c $Id: help2man.texi,v 1.5 2000/12/22 12:15:21 bod Exp $
@dircategory GNU admin
@direntry
@@ -121,7 +121,7 @@ By default (for want of anything better) this paragraph contains
@samp{manual page for @var{program} @var{version}}.
This option overrides an include file @samp{[name]} section
-(@xref{Including text}).
+(@pxref{Including text}).
@item --section @var{section}
@itemx -s @var{section}
@@ -130,7 +130,7 @@ section is 1.
@item --include @var{file}
@itemx -i @var{file}
-Include material from @var{file} (@xref{Including text}).
+Include material from @var{file} (@pxref{Including text}).
@item --opt-include @var{file}
@itemx -I @var{file}
@@ -156,7 +156,7 @@ Show help or version information.
Additional static text may be included in the generated manual page by
using the @samp{--include} and @samp{--opt-include} options
-(@xref{Invoking help2man}).
+(@pxref{Invoking help2man}).
The format for files included with these option is simple:
@@ -176,8 +176,9 @@ Patterns use the Perl regular expression syntax and may be followed by
the @samp{i}, @samp{s} or @samp{m} modifiers (@pxref{perlre, ,
perlre(1), *manpages*, The @code{perlre(1)} manual page})
-Anything before the first section or pattern is silently ignored and
-may be used for comments, RCS keywords and the like.
+Lines before the first section or pattern which begin with @samp{-}
+are processed as options. Anything else is silently ignored and may
+be used for comments, RCS keywords and the like.
The section output order is: