summaryrefslogtreecommitdiff
path: root/man/help2man
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-07-10 08:44:49 +0000
committerJim Meyering <jim@meyering.net>1999-07-10 08:44:49 +0000
commit41e1351fcad87624eaf9fa775a2b435f588562b5 (patch)
tree241c0497f5d056ca488bca10145638c58ba414e0 /man/help2man
parent1b5283ca7adfe721572eef14135d8d6cf1531b63 (diff)
downloadcoreutils-41e1351fcad87624eaf9fa775a2b435f588562b5.tar.gz
coreutils-41e1351fcad87624eaf9fa775a2b435f588562b5.tar.bz2
coreutils-41e1351fcad87624eaf9fa775a2b435f588562b5.zip
Import version 1.012.
Diffstat (limited to 'man/help2man')
-rwxr-xr-xman/help2man51
1 files changed, 33 insertions, 18 deletions
diff --git a/man/help2man b/man/help2man
index fde8e53fd..08695dad1 100755
--- a/man/help2man
+++ b/man/help2man
@@ -26,7 +26,7 @@ use Text::Tabs qw(expand);
use POSIX qw(strftime setlocale LC_TIME);
my $this_program = 'help2man';
-my $this_version = '1.011';
+my $this_version = '1.012';
my $version_info = <<EOT;
$this_program $this_version
@@ -42,28 +42,32 @@ my $help_info = <<EOT;
Usage: $this_program [OPTION]... EXECUTABLE
- --name=STRING use `STRING' as the description for the NAME paragraph
- --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
+ -n, --name=STRING use `STRING' as the description for the NAME paragraph
+ -s, --section=SECTION use `SECTION' as the section for the man page
+ -i, --include=FILE include material from `FILE'
+ -I, --opt-include=FILE include material from `FILE' if it exists
+ -o, --output=FILE send output to `FILE'
+ -N, --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 $section = 1;
my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
# Parse options.
+Getopt::Long::config('bundling');
GetOptions (
- 'name=s' => \$opt_name,
- '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 },
+ 'n|name=s' => \$opt_name,
+ 's|section=s' => \$section,
+ 'i|include=s' => \$include,
+ 'I|opt-include=s' => \$opt_include,
+ 'o|output=s' => \$opt_output,
+ 'N|no-info' => \$opt_no_info,
+ help => sub { print $help_info; exit },
+ version => sub { print $version_info; exit },
) or die $help_info;
die $help_info unless @ARGV == 1;
@@ -198,11 +202,12 @@ my $PROGRAM = uc $program;
# Header.
print <<EOT;
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
-.TH $PROGRAM 1 "$date" "$package $version" "FSF"
+.TH $PROGRAM "$section" "$date" "$package $version" FSF
.SH NAME
$include{NAME}
EOT
+my $break;
my $accumulate = 1;
my @description = ();
@@ -245,6 +250,7 @@ for (@help)
print $include{DESCRIPTION};
}
+ $break = 1;
next unless $_;
}
@@ -260,6 +266,7 @@ for (@help)
if (s/^(Options|Examples): *\n//)
{
print qq(.SH \U$1\n);
+ $break = '';
next unless length;
}
@@ -267,11 +274,16 @@ for (@help)
if (/^Report bugs |^Email bug reports to /)
{
print qq(.SH "REPORTING BUGS"\n$_\n);
+ $break = '';
next;
}
# Option subsections have second line indented.
- print qq(.SS "$1"\n) if s/^(\S.*)\n / /;
+ if (s/^(\S.*)\n / /)
+ {
+ print qq(.SS "$1"\n);
+ $break = '';
+ }
my $output = '';
while (length)
@@ -283,6 +295,7 @@ for (@help)
{
$indent = length $1;
$output .= ".TP\n$2\n$3\n";
+ $break = 1;
}
# Indented paragraph
@@ -290,14 +303,16 @@ for (@help)
{
$indent = length $1;
$output .= ".IP\n$2\n";
+ $break = 1;
}
# Left justified paragraph
else
{
s/(.*)\n?//;
- $output .= ".PP\n" if $output;
+ $output .= ".PP\n" if $break;
$output .= "$1\n";
+ $break = 1;
}
# Continuations