diff --git a/man/help2man b/man/help2man index c2251c34e..e3e5040c3 100755 --- a/man/help2man +++ b/man/help2man @@ -18,30 +18,22 @@ # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Written by Brendan O'Dea -# and François Pinard - -require 5.003; +use 5.004; use strict; use Getopt::Long; -use POSIX 'strftime'; +use POSIX qw(strftime setlocale LC_TIME); -my $RCS_Id = '$Id: help2man,v 1.3 1998/10/06 04:07:25 meyering Exp $'; my $this_program = 'help2man'; -my $this_version = '0.0'; - -if ($RCS_Id =~ /\$Id:\s+(\S+)\s+(\S+)/) -{ - $this_version = $2; - ($this_program = $1) =~ s/(\.\w+)?,v$//; -} - +my $this_version = '1.006'; my $version_info = < EOT my $help_info = < \$include, 'opt-include=s' => \$opt_include, 'output=s' => \$opt_output, + 'no-info' => \$opt_no_info, help => sub { print $help_info; exit }, version => sub { print $version_info; exit }, ) or die $help_info; @@ -112,7 +105,7 @@ if ($include or $opt_include) die "$this_program: no valid information found in `$include'\n" unless %include; - # Compress trailing blank lines + # Compress trailing blank lines. for (keys %include) { $include{$_} =~ s/\n+$//; @@ -128,6 +121,9 @@ if ($include or $opt_include) # Turn off localisation of executable's ouput. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; +# Turn off localisation of date (for strftime) +setlocale LC_TIME, 'C'; + # Grab help and version paragraphs from executable my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null` or die "$this_program: can't get `--help' info from $ARGV[0]\n"; @@ -183,6 +179,9 @@ else $program =~ s!.*/!!; +# no info for `info' itself +$opt_no_info = 1 if $program eq 'info'; + # --name overrides --include contents $include{NAME} = "$program \\- $opt_name" if $opt_name; @@ -228,14 +227,14 @@ for (@help) $accumulate = 0; } while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//; - # Include file overrides SYNOPSIS + # Include file overrides SYNOPSIS. print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis; # Dump any accumulated description text. print ".SH DESCRIPTION\n"; print @description; - # Add additional description text from include file + # Add additional description text from include file. if ($include{DESCRIPTION}) { print ".PP\n" unless $include{DESCRIPTION} =~ /^\..P/; @@ -313,12 +312,12 @@ for (@include) } # Refer to the real documentation. -if ($include{'SEE ALSO'} or $program ne 'info') +if ($include{'SEE ALSO'} or !$opt_no_info) { print qq(.SH "SEE ALSO"\n); print $include{'SEE ALSO'}, ".PP\n" if $include{'SEE ALSO'}; - print <