/sbin/grub is always built and grub.8 is produced automatically
This commit is contained in:
parent
45d89b3d1a
commit
a0ca5d0c06
21 changed files with 697 additions and 92 deletions
|
@ -1,2 +1,12 @@
|
|||
info_TEXINFOS = grub.texi multiboot.texi
|
||||
EXTRA_DIST = menu.lst
|
||||
man_MANS = grub.8
|
||||
HELP2MAN = $(srcdir)/help2man
|
||||
noinst_SCRIPTS = $(HELP2MAN)
|
||||
|
||||
EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS)
|
||||
|
||||
if GRUB_MAINT
|
||||
$(srcdir)/grub.8: ../grub/grub $(HELP2MAN)
|
||||
$(HELP2MAN) --name="the stage2 emulator shell" --section=8 \
|
||||
--output=$@ $<
|
||||
endif
|
||||
|
|
|
@ -70,19 +70,28 @@ VERSION = @VERSION@
|
|||
host_cpu = @host_cpu@
|
||||
host_vendor = @host_vendor@
|
||||
install_sh = @install_sh@
|
||||
sbingrub = @sbingrub@
|
||||
|
||||
|
||||
info_TEXINFOS = grub.texi multiboot.texi
|
||||
EXTRA_DIST = menu.lst
|
||||
man_MANS = grub.8
|
||||
HELP2MAN = $(srcdir)/help2man
|
||||
noinst_SCRIPTS = $(HELP2MAN)
|
||||
|
||||
EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS)
|
||||
subdir = docs
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(noinst_SCRIPTS)
|
||||
|
||||
DIST_SOURCES =
|
||||
TEXI2DVI = texi2dvi
|
||||
INFO_DEPS = grub.info multiboot.info
|
||||
DVIS = grub.dvi multiboot.dvi
|
||||
TEXINFOS = grub.texi multiboot.texi
|
||||
man8dir = $(mandir)/man8
|
||||
MANS = $(man_MANS)
|
||||
|
||||
NROFF = nroff
|
||||
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
|
||||
version.texi
|
||||
|
||||
|
@ -252,6 +261,47 @@ maintainer-clean-aminfo:
|
|||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install-man8:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
@list='$(man8_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
|
||||
uninstall-man8:
|
||||
@list='$(man8_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
install-man: $(MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-man8
|
||||
uninstall-man:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
@ -264,6 +314,7 @@ distdir: $(DISTFILES)
|
|||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile
|
||||
$(mkinstalldirs) $(distdir)/$(srcdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
|
@ -286,20 +337,20 @@ installcheck: installcheck-am
|
|||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-info-am
|
||||
install-data-am: install-info-am install-man
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-info
|
||||
uninstall-am: uninstall-info uninstall-man
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(INFO_DEPS)
|
||||
all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(MANS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(mandir)/man8
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
@ -332,14 +383,19 @@ maintainer-clean: maintainer-clean-am
|
|||
|
||||
.PHONY: mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
|
||||
install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \
|
||||
clean-aminfo maintainer-clean-aminfo tags distdir info-am info dvi-am \
|
||||
dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all install-strip \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
clean-aminfo maintainer-clean-aminfo install-man8 uninstall-man8 \
|
||||
install-man uninstall-man tags distdir info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all install-strip installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
@GRUB_MAINT_TRUE@$(srcdir)/grub.8: ../grub/grub $(HELP2MAN)
|
||||
@GRUB_MAINT_TRUE@ $(HELP2MAN) --name="the stage2 emulator shell" --section=8 \
|
||||
@GRUB_MAINT_TRUE@ --output=$@ $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
57
docs/grub.8
Normal file
57
docs/grub.8
Normal file
|
@ -0,0 +1,57 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.010.
|
||||
.TH GRUB "8" "June 2000" "GNU GRUB 0.5.92" "FSF"
|
||||
.SH NAME
|
||||
GRUB \- the stage2 emulator shell
|
||||
.SH SYNOPSIS
|
||||
.B GRUB
|
||||
[\fIOPTION\fR]...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Enter the GRand Unified Bootloader command shell.
|
||||
.TP
|
||||
\fB\-\-batch\fR
|
||||
turn on batch mode for non-interactive use
|
||||
.TP
|
||||
\fB\-\-boot\-drive\fR=\fIDRIVE\fR
|
||||
specify stage2 boot_drive [default=0x0]
|
||||
.TP
|
||||
\fB\-\-config\-file\fR=\fIFILE\fR
|
||||
specify stage2 config_file [default=/boot/grub/menu.lst]
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
display this message and exit
|
||||
.TP
|
||||
\fB\-\-hold\fR
|
||||
wait until a debugger will attach
|
||||
.TP
|
||||
\fB\-\-install\-partition\fR=\fIPAR\fR
|
||||
specify stage2 install_partition [default=0x20000]
|
||||
.TP
|
||||
\fB\-\-no\-config\-file\fR
|
||||
do not use the config file
|
||||
.TP
|
||||
\fB\-\-no\-curses\fR
|
||||
do not use curses
|
||||
.TP
|
||||
\fB\-\-read\-only\fR
|
||||
do not write anything to devices
|
||||
.TP
|
||||
\fB\-\-verbose\fR
|
||||
print verbose messages
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
print version information and exit
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to bug-grub@gnu.org
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B GRUB
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B GRUB
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info GRUB
|
||||
.PP
|
||||
should give you access to the complete manual.
|
|
@ -364,7 +364,7 @@ on the floppy.
|
|||
|
||||
If you install GRUB using this method, it will only have access to the
|
||||
command-line interface, since there is no filesystem in which to find a
|
||||
configuration file (FIXME: ref). If you want to use the menu interface, see
|
||||
configuration file. If you want to use the menu interface, see
|
||||
@ref{Automated install}.
|
||||
|
||||
Under an UNIX-like operating system, such as GNU, use @code{dd} as
|
||||
|
@ -427,7 +427,7 @@ place the @file{stage2} (and if desired, your configuration file called
|
|||
(after booting from the GRUB floppy):
|
||||
|
||||
@example
|
||||
install= (fd0)+1 (hd0) (hd0,2)/boot/grub/stage2 0x8000 p
|
||||
install= (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p
|
||||
@end example
|
||||
|
||||
This tells GRUB to grab the first sector of the floppy and use it as the
|
||||
|
@ -444,7 +444,7 @@ telling GRUB's stage1 to read from the first hard disk no matter where
|
|||
the stage1 was loaded from:
|
||||
|
||||
@example
|
||||
install= (fd0)+1 d (fd0) (hd0,2)/boot/grub/stage2 0x8000 p
|
||||
install= (fd0)+1 d (fd0) (hd0,1)/boot/grub/stage2 0x8000 p
|
||||
@end example
|
||||
|
||||
The @samp{d} option near the beginning is what sets the @emph{forced}
|
||||
|
@ -452,6 +452,26 @@ loading from the disk where the stage2 was installed from. Also, the
|
|||
@dfn{destination device} is changed to place the finished stage1 on the
|
||||
floppy disk.
|
||||
|
||||
@item
|
||||
@strong{Same as above, but place the stage1.5 in the first cylinder of
|
||||
the hard disk, and load the stage2 via the stage1.5:} Each of Stage 1.5s
|
||||
supports only one filesystem, so choose a stage1.5 that supports the
|
||||
filesystem where stage2 is located. Here it is assumed that the
|
||||
filesystem is ext2fs.
|
||||
|
||||
First, copy @file{e2fs_stage1_5} to the first cylinder after MBR
|
||||
(@pxref{MBR}):
|
||||
|
||||
@example
|
||||
dd if=e2fs_stage1_5/e2fs_stage1_5 of=/dev/hda bs=512 seek=1
|
||||
@end example
|
||||
|
||||
Second, specify the stage2 argument in the block-list format:
|
||||
|
||||
@example
|
||||
install= (fd0)+1 (hd0) (hd0)1+1 0x2000 p (hd0,1)/boot/grub/stage2
|
||||
@end example
|
||||
|
||||
@item
|
||||
@strong{Installing from an @emph{install directory} to the second hard
|
||||
disk:} Here we're loading the stage1 from a file on the first hard disk,
|
||||
|
@ -460,7 +480,7 @@ hard disk, and setting the stage2's @dfn{configuration file} to
|
|||
@file{(hd1,a)/grubdir/configfile}:
|
||||
|
||||
@example
|
||||
install= (hd0,2)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile
|
||||
install= (hd0,1)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
|
@ -517,7 +537,7 @@ file, used with exactly the same syntax.
|
|||
@c The list of available keys should be listed in @table, and should be
|
||||
@c explained exactly. Current explanation is obscure.
|
||||
Cursor movement and editing of the text on the line can be done via a
|
||||
subset of the functions available in the BASH (FIXME: ref) shell
|
||||
subset of the functions available in the BASH shell
|
||||
(@kbd{C-f} forward, @kbd{C-b} backward, @kbd{C-a} beginning of line,
|
||||
@kbd{C-e} end of line, @kbd{C-k} delete to end, @kbd{C-u} delete to
|
||||
beginning; the PC left and right arrow keys, @key{HOME}, @key{DEL}, and
|
||||
|
|
397
docs/help2man
Normal file
397
docs/help2man
Normal file
|
@ -0,0 +1,397 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
# Generate a short man page from --help and --version output.
|
||||
# Copyright © 1997, 98, 99 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Written by Brendan O'Dea <bod@compusol.com.au>
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime setlocale LC_TIME);
|
||||
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '1.010';
|
||||
my $version_info = <<EOT;
|
||||
$this_program $this_version
|
||||
|
||||
Copyright (C) 1997, 98, 99 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;
|
||||
`$this_program' generates a man page out of `--help' and `--version' output.
|
||||
|
||||
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
|
||||
--section=SECTION use `SECTION' as the section for the man page
|
||||
--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_no_info,
|
||||
$opt_section);
|
||||
|
||||
# Parse options.
|
||||
GetOptions (
|
||||
'name=s' => \$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 },
|
||||
) or die $help_info;
|
||||
|
||||
die $help_info unless @ARGV == 1;
|
||||
|
||||
my %include = ();
|
||||
my @include = (); # to retain order
|
||||
|
||||
# Process include file (if given). Format is:
|
||||
#
|
||||
# [section name]
|
||||
# verbatim text
|
||||
|
||||
if ($include or $opt_include)
|
||||
{
|
||||
if (open INC, $include || $opt_include)
|
||||
{
|
||||
my $sect;
|
||||
|
||||
while (<INC>)
|
||||
{
|
||||
if (/^\[([^]]+)\]/)
|
||||
{
|
||||
$sect = uc $1;
|
||||
$sect =~ s/^\s+//;
|
||||
$sect =~ s/\s+$//;
|
||||
next;
|
||||
}
|
||||
|
||||
# Silently ignore anything before the first
|
||||
# section--allows for comments and revision info.
|
||||
next unless $sect;
|
||||
|
||||
push @include, $sect unless $include{$sect};
|
||||
$include{$sect} ||= '';
|
||||
$include{$sect} .= $_;
|
||||
}
|
||||
|
||||
close INC;
|
||||
|
||||
die "$this_program: no valid information found in `$include'\n"
|
||||
unless %include;
|
||||
|
||||
# Compress trailing blank lines.
|
||||
for (keys %include)
|
||||
{
|
||||
$include{$_} =~ s/\n+$//;
|
||||
$include{$_} .= "\n" unless /^NAME$/;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
die "$this_program: can't open `$include' ($!)\n" if $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";
|
||||
|
||||
my @version = split /\n\n+/, `$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;
|
||||
(my $program = $ARGV[0]) =~ s!.*/!!;
|
||||
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
|
||||
or die "$this_program: can't unlink $opt_output ($!)\n"
|
||||
if -e $opt_output;
|
||||
|
||||
open STDOUT, ">$opt_output"
|
||||
or die "$this_program: can't create $opt_output ($!)\n";
|
||||
}
|
||||
|
||||
# The first line of the --version information is assumed to be in one
|
||||
# of the following formats:
|
||||
#
|
||||
# <version>
|
||||
# <program> <version>
|
||||
# {GNU,Free} <program> <version>
|
||||
# <program> ({GNU,Free} <package>) <version>
|
||||
# <program> - {GNU,Free} <package> <version>
|
||||
#
|
||||
# and seperated from any copyright/author details by a blank line.
|
||||
|
||||
$_ = shift @version;
|
||||
|
||||
if (/^(\S+)\s+\(((?:GNU|Free)\s+[^)]+)\)\s+(.*)/ or
|
||||
/^(\S+)\s+-\s*((?:GNU|Free)\s+\S+)\s+(.*)/)
|
||||
{
|
||||
$program = $1;
|
||||
$package = $2;
|
||||
$version = $3;
|
||||
}
|
||||
elsif (/^((?:GNU|Free)\s+)?(\S+)\s+(.*)/)
|
||||
{
|
||||
$program = $2;
|
||||
$package = $1 ? "$1$2" : $2;
|
||||
$version = $3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = $_;
|
||||
}
|
||||
|
||||
$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;
|
||||
|
||||
# Default (useless) NAME paragraph
|
||||
$include{NAME} ||= "$program \\- manual page for $program $version";
|
||||
|
||||
# Man pages traditionally have the page title in caps.
|
||||
my $PROGRAM = uc $program;
|
||||
|
||||
# Header.
|
||||
print <<EOT;
|
||||
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
|
||||
.TH $PROGRAM "$section" "$date" "$package $version" "FSF"
|
||||
.SH NAME
|
||||
$include{NAME}
|
||||
EOT
|
||||
|
||||
my $accumulate = 1;
|
||||
my @description = ();
|
||||
|
||||
sub convert_option;
|
||||
|
||||
# Output converted --help information.
|
||||
for (@help)
|
||||
{
|
||||
chomp;
|
||||
|
||||
if (s/^Usage:\s+\S+\s+(.*)\n?//)
|
||||
{
|
||||
# Turn the usage clause into a synopsis.
|
||||
my $synopsis = '';
|
||||
|
||||
do {
|
||||
my $syn = $1;
|
||||
$syn =~ s/(([][]|\.\.+)+)/\\fR$1\\fI/g;
|
||||
$syn =~ s/^/\\fI/ unless $syn =~ s/^\\fR//;
|
||||
$syn .= '\fR';
|
||||
$syn =~ s/\\fI(\s*)\\fR/$1/g;
|
||||
|
||||
$synopsis .= ".br\n" unless $accumulate;
|
||||
$synopsis .= ".B $program\n";
|
||||
$synopsis .= "$syn\n";
|
||||
$accumulate = 0;
|
||||
} while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//;
|
||||
|
||||
# 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.
|
||||
if ($include{DESCRIPTION})
|
||||
{
|
||||
print ".PP\n" unless $include{DESCRIPTION} =~ /^\..P/;
|
||||
print $include{DESCRIPTION};
|
||||
}
|
||||
|
||||
next unless $_;
|
||||
}
|
||||
|
||||
# Accumulate text if the synopsis has not been produced yet.
|
||||
if ($accumulate)
|
||||
{
|
||||
push @description, ".PP\n" if @description;
|
||||
push @description, "$_\n";
|
||||
next;
|
||||
}
|
||||
|
||||
# Convert some standard paragraph names
|
||||
if (s/^(Options|Examples):\s*\n//)
|
||||
{
|
||||
print qq(.SH \U$1\n);
|
||||
next unless length;
|
||||
}
|
||||
|
||||
# Catch bug report text.
|
||||
if (/^Report bugs |^Email bug reports to /)
|
||||
{
|
||||
print qq(.SH "REPORTING BUGS"\n$_\n);
|
||||
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.
|
||||
print qq(.SS "$1"\n) if s/^(\S.*)\n(\s)/$2/;
|
||||
|
||||
my $ind = 0;
|
||||
for (split /\n/)
|
||||
{
|
||||
# indented paragraph
|
||||
if (/^\s/)
|
||||
{
|
||||
# Join continued lines when indented to the same point as
|
||||
# text following at least two spaces on the previous line.
|
||||
if ($ind > 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 $_;
|
||||
}
|
||||
}
|
||||
# Anything else.
|
||||
else
|
||||
{
|
||||
print ".PP\n" unless $ind < 0;
|
||||
print "$_\n";
|
||||
$ind = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Print any include items other than the ones we have already dealt
|
||||
# with.
|
||||
for (@include)
|
||||
{
|
||||
print qq(.SH "$_"\n$include{$_})
|
||||
unless /^(NAME|SYNOPSIS|DESCRIPTION|SEE ALSO)$/;
|
||||
}
|
||||
|
||||
# Refer to the real documentation.
|
||||
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 $opt_no_info;
|
||||
The full documentation for
|
||||
.B $program
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B $program
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info $program
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
EOT
|
||||
}
|
||||
|
||||
# Output converted --version information.
|
||||
for (@version)
|
||||
{
|
||||
chomp;
|
||||
|
||||
# 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.
|
||||
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.
|
||||
s/(.)\n(Copyright\s|This is free software)/$1\n.br\n$2/g;
|
||||
|
||||
print "$_\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
# Convert option dashes to \- to stop nroff from hyphenating 'em, and
|
||||
# embolden. Option arguments get italicised.
|
||||
sub convert_option
|
||||
{
|
||||
my $option = '\fB' . shift;
|
||||
|
||||
$option =~ s/-/\\-/g;
|
||||
unless ($option =~ s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
|
||||
{
|
||||
$option =~ s/=(.)/\\fR=\\fI$1/;
|
||||
$option =~ s/ (.)/ \\fI$1/;
|
||||
$option .= '\fR';
|
||||
}
|
||||
|
||||
$option;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue