From efbf4469d4939b7e4a5b2aa83bdffd284a798a05 Mon Sep 17 00:00:00 2001 From: okuji Date: Thu, 24 Jun 1999 16:37:20 +0000 Subject: [PATCH] update help2man --- ChangeLog | 10 ++++ Makefile.am | 2 +- Makefile.in | 2 +- docs/grub.8 | 4 +- docs/help2man | 161 +++++++++++++++++++++++++------------------------- 5 files changed, 95 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index 275371404..9fdcfee8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +1999-06-24 OKUJI Yoshinori + + * 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 Build process is cleaned up. Stage 2 and Stage 1.5's are all diff --git a/Makefile.am b/Makefile.am index 1f2fcdeb3..50ac3dfc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = stage1 stage2 docs debian grub +SUBDIRS = stage1 stage2 grub docs debian EXTRA_DIST = BUGS # We get $(PACKAGE) and $(VERSION) from debian/changelog. diff --git a/Makefile.in b/Makefile.in index e02879de7..51eb6ed86 100644 --- a/Makefile.in +++ b/Makefile.in @@ -74,7 +74,7 @@ host_vendor = @host_vendor@ install_sh = @install_sh@ -SUBDIRS = stage1 stage2 docs debian grub +SUBDIRS = stage1 stage2 grub docs debian EXTRA_DIST = BUGS subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/docs/grub.8 b/docs/grub.8 index a3830ad72..852858663 100644 --- a/docs/grub.8 +++ b/docs/grub.8 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.010. -.TH GRUB "8" "June 2000" "GNU GRUB 0.5.92" "FSF" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.012. +.TH GRUB "8" "June 1999" "GNU GRUB 0.5.92" FSF .SH NAME GRUB \- the stage2 emulator shell .SH SYNOPSIS diff --git a/docs/help2man b/docs/help2man index f19bb0514..d50592dec 100644 --- a/docs/help2man +++ b/docs/help2man @@ -22,10 +22,11 @@ use 5.004; use strict; use Getopt::Long; +use Text::Tabs qw(expand); use POSIX qw(strftime setlocale LC_TIME); my $this_program = 'help2man'; -my $this_version = '1.010'; +my $this_version = '1.012'; my $version_info = < \$opt_name, - 'include=s' => \$include, - 'opt-include=s' => \$opt_include, - 'output=s' => \$opt_output, - 'no-info' => \$opt_no_info, - 'section=s' => \$opt_section, - 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; @@ -127,11 +129,14 @@ if ($include or $opt_include) # Turn off localisation of date (for strftime) 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 -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"; -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"; my $date = strftime "%B %Y", localtime; @@ -139,10 +144,6 @@ my $date = strftime "%B %Y", localtime; my $package = $program; my $version; -# Set the section to 1 by default. -my $section = 1; -$section = $opt_section if $opt_section; - if ($opt_output) { unlink $opt_output @@ -166,14 +167,14 @@ if ($opt_output) $_ = shift @version; -if (/^(\S+)\s+\(((?:GNU|Free)\s+[^)]+)\)\s+(.*)/ or - /^(\S+)\s+-\s*((?:GNU|Free)\s+\S+)\s+(.*)/) +if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or + /^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/) { $program = $1; $package = $2; $version = $3; } -elsif (/^((?:GNU|Free)\s+)?(\S+)\s+(.*)/) +elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/) { $program = $2; $package = $1 ? "$1$2" : $2; @@ -201,11 +202,12 @@ my $PROGRAM = uc $program; # Header. print < 0 and /^ {$ind}\S/) - { - 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 $_; - } + $indent = length $1; + $output .= ".TP\n$2\n$3\n"; + $break = 1; } - # Anything else. + + # Indented paragraph + elsif (s/^( +)(\S.*)\n?//) + { + $indent = length $1; + $output .= ".IP\n$2\n"; + $break = 1; + } + + # Left justified paragraph else { - print ".PP\n" unless $ind < 0; - print "$_\n"; - $ind = -1; + s/(.*)\n?//; + $output .= ".PP\n" if $break; + $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 @@ -363,16 +364,16 @@ for (@version) s/([A-Za-z])-\n */$1/g; # 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. - if (/^Copyright\s\\/) { print ".SH COPYRIGHT\n" } - elsif (/^Written\s+by/) { print ".SH AUTHOR\n" } - else { print ".PP\n"; } + if (/^Copyright \\/) { print ".SH COPYRIGHT\n" } + elsif (/^Written +by/) { print ".SH AUTHOR\n" } + else { print ".PP\n"; } # Insert line breaks before additional copyright messages and the # 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"; }