update help2man
This commit is contained in:
parent
2465e9eb0b
commit
efbf4469d4
5 changed files with 95 additions and 84 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
1999-06-24 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* Makefile.am (SUBDIRS): Change the order of the directories so
|
||||||
|
that a directory will be made after the dependent directories
|
||||||
|
are made. `grub' depends on `stage2', and `docs' depends on
|
||||||
|
`grub'. Do not make in parallel.
|
||||||
|
* docs/help2man: Copied from help2man-1.012, which contains my
|
||||||
|
previous change.
|
||||||
|
* docs/grub.8: Regenerated.
|
||||||
|
|
||||||
1999-06-24 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-06-24 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
Build process is cleaned up. Stage 2 and Stage 1.5's are all
|
Build process is cleaned up. Stage 2 and Stage 1.5's are all
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SUBDIRS = stage1 stage2 docs debian grub
|
SUBDIRS = stage1 stage2 grub docs debian
|
||||||
EXTRA_DIST = BUGS
|
EXTRA_DIST = BUGS
|
||||||
|
|
||||||
# We get $(PACKAGE) and $(VERSION) from debian/changelog.
|
# We get $(PACKAGE) and $(VERSION) from debian/changelog.
|
||||||
|
|
|
@ -74,7 +74,7 @@ host_vendor = @host_vendor@
|
||||||
install_sh = @install_sh@
|
install_sh = @install_sh@
|
||||||
|
|
||||||
|
|
||||||
SUBDIRS = stage1 stage2 docs debian grub
|
SUBDIRS = stage1 stage2 grub docs debian
|
||||||
EXTRA_DIST = BUGS
|
EXTRA_DIST = BUGS
|
||||||
subdir = .
|
subdir = .
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.010.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.012.
|
||||||
.TH GRUB "8" "June 2000" "GNU GRUB 0.5.92" "FSF"
|
.TH GRUB "8" "June 1999" "GNU GRUB 0.5.92" FSF
|
||||||
.SH NAME
|
.SH NAME
|
||||||
GRUB \- the stage2 emulator shell
|
GRUB \- the stage2 emulator shell
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
161
docs/help2man
161
docs/help2man
|
@ -22,10 +22,11 @@
|
||||||
use 5.004;
|
use 5.004;
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use Text::Tabs qw(expand);
|
||||||
use POSIX qw(strftime setlocale LC_TIME);
|
use POSIX qw(strftime setlocale LC_TIME);
|
||||||
|
|
||||||
my $this_program = 'help2man';
|
my $this_program = 'help2man';
|
||||||
my $this_version = '1.010';
|
my $this_version = '1.012';
|
||||||
my $version_info = <<EOT;
|
my $version_info = <<EOT;
|
||||||
$this_program $this_version
|
$this_program $this_version
|
||||||
|
|
||||||
|
@ -41,31 +42,32 @@ my $help_info = <<EOT;
|
||||||
|
|
||||||
Usage: $this_program [OPTION]... EXECUTABLE
|
Usage: $this_program [OPTION]... EXECUTABLE
|
||||||
|
|
||||||
--name=STRING use `STRING' as the description for the NAME paragraph
|
-n, --name=STRING use `STRING' as the description for the NAME paragraph
|
||||||
--include=FILE include material from `FILE'
|
-s, --section=SECTION use `SECTION' as the section for the man page
|
||||||
--opt-include=FILE include material from `FILE' if it exists
|
-i, --include=FILE include material from `FILE'
|
||||||
--output=FILE send output to `FILE'
|
-I, --opt-include=FILE include material from `FILE' if it exists
|
||||||
--no-info suppress pointer to Texinfo manual
|
-o, --output=FILE send output to `FILE'
|
||||||
--section=SECTION use `SECTION' as the section for the man page
|
-N, --no-info suppress pointer to Texinfo manual
|
||||||
--help print this help, then exit
|
--help print this help, then exit
|
||||||
--version print $this_program program version number, then exit
|
--version print $this_program program version number, then exit
|
||||||
|
|
||||||
EXECUTABLE should accept `--help' and `version' options.
|
EXECUTABLE should accept `--help' and `version' options.
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info,
|
my $section = 1;
|
||||||
$opt_section);
|
my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
|
||||||
|
|
||||||
# Parse options.
|
# Parse options.
|
||||||
|
Getopt::Long::config('bundling');
|
||||||
GetOptions (
|
GetOptions (
|
||||||
'name=s' => \$opt_name,
|
'n|name=s' => \$opt_name,
|
||||||
'include=s' => \$include,
|
's|section=s' => \$section,
|
||||||
'opt-include=s' => \$opt_include,
|
'i|include=s' => \$include,
|
||||||
'output=s' => \$opt_output,
|
'I|opt-include=s' => \$opt_include,
|
||||||
'no-info' => \$opt_no_info,
|
'o|output=s' => \$opt_output,
|
||||||
'section=s' => \$opt_section,
|
'N|no-info' => \$opt_no_info,
|
||||||
help => sub { print $help_info; exit },
|
help => sub { print $help_info; exit },
|
||||||
version => sub { print $version_info; exit },
|
version => sub { print $version_info; exit },
|
||||||
) or die $help_info;
|
) or die $help_info;
|
||||||
|
|
||||||
die $help_info unless @ARGV == 1;
|
die $help_info unless @ARGV == 1;
|
||||||
|
@ -127,11 +129,14 @@ if ($include or $opt_include)
|
||||||
# Turn off localisation of date (for strftime)
|
# Turn off localisation of date (for strftime)
|
||||||
setlocale LC_TIME, 'C';
|
setlocale LC_TIME, 'C';
|
||||||
|
|
||||||
|
# Expand tabs, strip trailing spaces and break into paragraphs
|
||||||
|
sub paragraphs { split /\n\n+/, join '', expand @_ }
|
||||||
|
|
||||||
# Grab help and version paragraphs from executable
|
# Grab help and version paragraphs from executable
|
||||||
my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
|
my @help = paragraphs `$ARGV[0] --help 2>/dev/null`
|
||||||
or die "$this_program: can't get `--help' info from $ARGV[0]\n";
|
or die "$this_program: can't get `--help' info from $ARGV[0]\n";
|
||||||
|
|
||||||
my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null`
|
my @version = paragraphs `$ARGV[0] --version 2>/dev/null`
|
||||||
or die "$this_program: can't get `--version' info from $ARGV[0]\n";
|
or die "$this_program: can't get `--version' info from $ARGV[0]\n";
|
||||||
|
|
||||||
my $date = strftime "%B %Y", localtime;
|
my $date = strftime "%B %Y", localtime;
|
||||||
|
@ -139,10 +144,6 @@ my $date = strftime "%B %Y", localtime;
|
||||||
my $package = $program;
|
my $package = $program;
|
||||||
my $version;
|
my $version;
|
||||||
|
|
||||||
# Set the section to 1 by default.
|
|
||||||
my $section = 1;
|
|
||||||
$section = $opt_section if $opt_section;
|
|
||||||
|
|
||||||
if ($opt_output)
|
if ($opt_output)
|
||||||
{
|
{
|
||||||
unlink $opt_output
|
unlink $opt_output
|
||||||
|
@ -166,14 +167,14 @@ if ($opt_output)
|
||||||
|
|
||||||
$_ = shift @version;
|
$_ = shift @version;
|
||||||
|
|
||||||
if (/^(\S+)\s+\(((?:GNU|Free)\s+[^)]+)\)\s+(.*)/ or
|
if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or
|
||||||
/^(\S+)\s+-\s*((?:GNU|Free)\s+\S+)\s+(.*)/)
|
/^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/)
|
||||||
{
|
{
|
||||||
$program = $1;
|
$program = $1;
|
||||||
$package = $2;
|
$package = $2;
|
||||||
$version = $3;
|
$version = $3;
|
||||||
}
|
}
|
||||||
elsif (/^((?:GNU|Free)\s+)?(\S+)\s+(.*)/)
|
elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/)
|
||||||
{
|
{
|
||||||
$program = $2;
|
$program = $2;
|
||||||
$package = $1 ? "$1$2" : $2;
|
$package = $1 ? "$1$2" : $2;
|
||||||
|
@ -201,11 +202,12 @@ my $PROGRAM = uc $program;
|
||||||
# Header.
|
# Header.
|
||||||
print <<EOT;
|
print <<EOT;
|
||||||
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
|
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
|
||||||
.TH $PROGRAM "$section" "$date" "$package $version" "FSF"
|
.TH $PROGRAM "$section" "$date" "$package $version" FSF
|
||||||
.SH NAME
|
.SH NAME
|
||||||
$include{NAME}
|
$include{NAME}
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
my $break;
|
||||||
my $accumulate = 1;
|
my $accumulate = 1;
|
||||||
my @description = ();
|
my @description = ();
|
||||||
|
|
||||||
|
@ -216,7 +218,7 @@ for (@help)
|
||||||
{
|
{
|
||||||
chomp;
|
chomp;
|
||||||
|
|
||||||
if (s/^Usage:\s+\S+\s+(.*)\n?//)
|
if (s/^Usage: +\S+ +(.*)\n?//)
|
||||||
{
|
{
|
||||||
# Turn the usage clause into a synopsis.
|
# Turn the usage clause into a synopsis.
|
||||||
my $synopsis = '';
|
my $synopsis = '';
|
||||||
|
@ -226,13 +228,13 @@ for (@help)
|
||||||
$syn =~ s/(([][]|\.\.+)+)/\\fR$1\\fI/g;
|
$syn =~ s/(([][]|\.\.+)+)/\\fR$1\\fI/g;
|
||||||
$syn =~ s/^/\\fI/ unless $syn =~ s/^\\fR//;
|
$syn =~ s/^/\\fI/ unless $syn =~ s/^\\fR//;
|
||||||
$syn .= '\fR';
|
$syn .= '\fR';
|
||||||
$syn =~ s/\\fI(\s*)\\fR/$1/g;
|
$syn =~ s/\\fI( *)\\fR/$1/g;
|
||||||
|
|
||||||
$synopsis .= ".br\n" unless $accumulate;
|
$synopsis .= ".br\n" unless $accumulate;
|
||||||
$synopsis .= ".B $program\n";
|
$synopsis .= ".B $program\n";
|
||||||
$synopsis .= "$syn\n";
|
$synopsis .= "$syn\n";
|
||||||
$accumulate = 0;
|
$accumulate = 0;
|
||||||
} while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//;
|
} while s/^(?:Usage| *or): +\S+ +(.*)\n?//;
|
||||||
|
|
||||||
# Include file overrides SYNOPSIS.
|
# Include file overrides SYNOPSIS.
|
||||||
print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis;
|
print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis;
|
||||||
|
@ -248,6 +250,7 @@ for (@help)
|
||||||
print $include{DESCRIPTION};
|
print $include{DESCRIPTION};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$break = 1;
|
||||||
next unless $_;
|
next unless $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,9 +263,10 @@ for (@help)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Convert some standard paragraph names
|
# Convert some standard paragraph names
|
||||||
if (s/^(Options|Examples):\s*\n//)
|
if (s/^(Options|Examples): *\n//)
|
||||||
{
|
{
|
||||||
print qq(.SH \U$1\n);
|
print qq(.SH \U$1\n);
|
||||||
|
$break = '';
|
||||||
next unless length;
|
next unless length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,59 +274,56 @@ for (@help)
|
||||||
if (/^Report bugs |^Email bug reports to /)
|
if (/^Report bugs |^Email bug reports to /)
|
||||||
{
|
{
|
||||||
print qq(.SH "REPORTING BUGS"\n$_\n);
|
print qq(.SH "REPORTING BUGS"\n$_\n);
|
||||||
|
$break = '';
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Special case for tar 1.12: --label=NAME\nPATTERN.
|
|
||||||
s{(\n[ \t]*)(-V,[ \t]+--label=NAME.*)\n[ \t]+PATTERN[ \t]+}
|
|
||||||
{$1$2$1\\&...=PATTERN };
|
|
||||||
|
|
||||||
# Convert options.
|
|
||||||
s/((?:^|,)\s+)(-[][\w=-]+|\\&\S+)/$1 . convert_option $2/mge;
|
|
||||||
|
|
||||||
# Option subsections have second line indented.
|
# Option subsections have second line indented.
|
||||||
print qq(.SS "$1"\n) if s/^(\S.*)\n(\s)/$2/;
|
if (s/^(\S.*)\n / /)
|
||||||
|
|
||||||
my $ind = 0;
|
|
||||||
for (split /\n/)
|
|
||||||
{
|
{
|
||||||
# indented paragraph
|
print qq(.SS "$1"\n);
|
||||||
if (/^\s/)
|
$break = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
my $output = '';
|
||||||
|
while (length)
|
||||||
|
{
|
||||||
|
my $indent = 0;
|
||||||
|
|
||||||
|
# Tagged paragraph
|
||||||
|
if (s/^( +(\S.*?) +)(\S.*)\n?//)
|
||||||
{
|
{
|
||||||
# Join continued lines when indented to the same point as
|
$indent = length $1;
|
||||||
# text following at least two spaces on the previous line.
|
$output .= ".TP\n$2\n$3\n";
|
||||||
if ($ind > 0 and /^ {$ind}\S/)
|
$break = 1;
|
||||||
{
|
|
||||||
s/^\s+//;
|
|
||||||
print "$_\n" if $_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# use the words(s) before two or more spaces for the
|
|
||||||
# tag
|
|
||||||
s/^(\s+)//;
|
|
||||||
$ind = length $1;
|
|
||||||
|
|
||||||
if (s/(\s\s+)/\n/)
|
|
||||||
{
|
|
||||||
$ind += (length $1) + index $_, "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ind = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print ".TP\n$_\n" if $_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
# Anything else.
|
|
||||||
|
# Indented paragraph
|
||||||
|
elsif (s/^( +)(\S.*)\n?//)
|
||||||
|
{
|
||||||
|
$indent = length $1;
|
||||||
|
$output .= ".IP\n$2\n";
|
||||||
|
$break = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Left justified paragraph
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ".PP\n" unless $ind < 0;
|
s/(.*)\n?//;
|
||||||
print "$_\n";
|
$output .= ".PP\n" if $break;
|
||||||
$ind = -1;
|
$output .= "$1\n";
|
||||||
|
$break = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Continuations
|
||||||
|
$output .= "$1\n" while s/^ {$indent}(\S.*)\n?//;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_ = $output;
|
||||||
|
|
||||||
|
# Convert options.
|
||||||
|
s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge;
|
||||||
|
print;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print any include items other than the ones we have already dealt
|
# Print any include items other than the ones we have already dealt
|
||||||
|
@ -363,16 +364,16 @@ for (@version)
|
||||||
s/([A-Za-z])-\n */$1/g;
|
s/([A-Za-z])-\n */$1/g;
|
||||||
|
|
||||||
# Convert copyright symbol or (c) to nroff character.
|
# Convert copyright symbol or (c) to nroff character.
|
||||||
s/Copyright\s+(?:\xa9|\([Cc]\))/Copyright \\(co/g;
|
s/Copyright +(?:\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" }
|
if (/^Copyright \\/) { print ".SH COPYRIGHT\n" }
|
||||||
elsif (/^Written\s+by/) { print ".SH AUTHOR\n" }
|
elsif (/^Written +by/) { print ".SH AUTHOR\n" }
|
||||||
else { print ".PP\n"; }
|
else { print ".PP\n"; }
|
||||||
|
|
||||||
# Insert line breaks before additional copyright messages and the
|
# 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;
|
s/(.)\n(Copyright |This is free software)/$1\n.br\n$2/g;
|
||||||
|
|
||||||
print "$_\n";
|
print "$_\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue