summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-12-11 13:34:23 +0000
committerJim Meyering <jim@meyering.net>1998-12-11 13:34:23 +0000
commitb2747b91a856aa2fc65a5f2e62e1be2ef66b5dde (patch)
treee9c80250ee77b46bd4799712b8f0a0757fb71dfa /man
parent0963c4ba11a69664efe69fd3311c1cd8c63e9c82 (diff)
downloadcoreutils-b2747b91a856aa2fc65a5f2e62e1be2ef66b5dde.tar.xz
import version 1.006
Diffstat (limited to 'man')
-rwxr-xr-xman/help2man48
1 files changed, 25 insertions, 23 deletions
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 <bod@compusol.com.au>
-# and François Pinard <pinard@IRO.UMontreal.CA>
-
-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;
$this_program $this_version
Copyright (C) 1997, 98 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Written by Brendan O'Dea <bod\@compusol.com.au>
EOT
my $help_info = <<EOT;
@@ -53,14 +45,14 @@ Usage: $this_program [OPTION]... EXECUTABLE
--include=FILE include material from `FILE'
--opt-include=FILE include material from `FILE' if it exists
--output=FILE send output to `FILE'
+ --no-info suppress pointer to Texinfo manual
--help print this help, then exit
--version print $this_program program version number, then exit
EXECUTABLE should accept `--help' and `version' options.
EOT
-my ($include, $opt_name, $opt_include, $opt_output, $opt_help,
- $opt_version);
+my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
# Parse options.
GetOptions (
@@ -68,6 +60,7 @@ GetOptions (
'include=s' => \$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 <<EOT unless $program eq 'info';
+ print <<EOT unless $opt_no_info;
The full documentation for
.B $program
is maintained as a Texinfo manual. If the
@@ -338,16 +337,19 @@ for (@version)
{
chomp;
- # Convert copyright symbol or (c) to nroff character
+ # Join hyphenated lines.
+ s/([A-Za-z])-\n */$1/g;
+
+ # Convert copyright symbol or (c) to nroff character.
s/Copyright\s+(?:\xa9|\([Cc]\))/Copyright \\(co/g;
- # Insert appropriate headings for copyright and author
+ # Insert appropriate headings for copyright and author.
if (/^Copyright\s\\/) { print ".SH COPYRIGHT\n" }
elsif (/^Written\s+by/) { print ".SH AUTHOR\n" }
else { print ".PP\n"; }
# Insert line breaks before additional copyright messages and the
- # disclaimer
+ # disclaimer.
s/(.)\n(Copyright\s|This is free software)/$1\n.br\n$2/g;
print "$_\n";