mirror of
https://github.com/GnoConsortium/gno-docs.git
synced 2024-12-07 04:49:19 +00:00
fix and reenable generation of html man pages
This commit is contained in:
parent
fc7eaec87c
commit
fa63840adf
@ -3,7 +3,7 @@
|
||||
#
|
||||
SRCROOT = .
|
||||
WEB_HOME_BASE =
|
||||
SUBPROJECTS = refs refs.aug96
|
||||
SUBPROJECTS = refs refs.aug96 man
|
||||
|
||||
DYNAMIC_TARGETS = $(WEB_HOME)/head.html \
|
||||
$(WEB_HOME)/tail.html \
|
||||
|
3
README
3
README
@ -19,6 +19,9 @@ README.build - Detailed build instructions.
|
||||
etc - These are configuration files for the document build.
|
||||
See README.build for details.
|
||||
*.html - Top level web pages
|
||||
man - Man Pages; the files in this directory are used
|
||||
for generating an HTML version of the manual pages
|
||||
that are installed under GNO proper.
|
||||
refs/intro - Introduction and Installation Manual
|
||||
refs/kernel - GNO Kernel Reference Manual
|
||||
refs/gsh - GNO Shell Reference Manual
|
||||
|
@ -21,6 +21,7 @@ Required Tools:
|
||||
dvips
|
||||
dvipdfm
|
||||
latex2html
|
||||
man2html
|
||||
|
||||
Preparation:
|
||||
|
||||
|
48
man/GNUmakefile
Normal file
48
man/GNUmakefile
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Generation of HTML versions of the manual pages
|
||||
#
|
||||
|
||||
SRCROOT = ..
|
||||
WEB_HOME_BASE = man
|
||||
SUBPROJECTS =
|
||||
|
||||
# This is the directory where the main GNO source repository
|
||||
# is checked out. If you have to modify it for your local
|
||||
# installation, create the $(SRCROOT)/etc/const-local.mk file
|
||||
# and set it there with a fully qualified pathname.
|
||||
GNO_SOURCE = ../../gno
|
||||
|
||||
TARGETS2 = $(WEB_HOME)/gsh.12.html \
|
||||
$(WEB_HOME)/gsh.3.html \
|
||||
$(WEB_HOME)/gsh.4.html \
|
||||
$(WEB_HOME)/gsh.5.html \
|
||||
$(WEB_HOME)/install.html \
|
||||
$(WEB_HOME)/kern.html \
|
||||
$(WEB_HOME)/man1.html \
|
||||
$(WEB_HOME)/man2.html \
|
||||
$(WEB_HOME)/man3.html \
|
||||
$(WEB_HOME)/man4.html
|
||||
|
||||
include $(SRCROOT)/etc/const-priv.mk
|
||||
include $(SRCROOT)/etc/const.mk
|
||||
-include $(SRCROOT)/etc/const-local.mk
|
||||
|
||||
MANORG = $(GNO_SOURCE)/usr.man
|
||||
MKSO = $(MANORG)/mkso.data
|
||||
|
||||
include $(SRCROOT)/etc/rules.mk
|
||||
|
||||
|
||||
buildLocal:: manBuild
|
||||
|
||||
# We do a straight copy on these ones.
|
||||
#$(WEB_HOME)/%.html: %.html
|
||||
# install -m644 $< $@
|
||||
|
||||
manBuild: manSetup
|
||||
@GNOROOT="$(GNO_SOURCE)" MANHTML="$(WEB_HOME)" NAME="$(NAME)" \
|
||||
ADDR="$(ADDRESS)" MKSO="$(MKSO)" \
|
||||
./mkhtmlman
|
||||
# HTMLROOT="$(HTML_ROOT)"
|
||||
|
||||
manSetup:
|
25
man/ignored.pages
Normal file
25
man/ignored.pages
Normal file
@ -0,0 +1,25 @@
|
||||
# These are files for which we will _not_ generate html man pages.
|
||||
# It is critical that there be no whitespace either preceeding nor
|
||||
# following these file names.
|
||||
#
|
||||
# $Id: ignored.pages,v 1.2 1998/06/12 14:47:30 gdr-ftp Exp $
|
||||
#
|
||||
00.DUMMY
|
||||
../../gno/usr.bin/awk/tests/addr.1
|
||||
../../gno/usr.bin/awk/tests/out/out.1.2
|
||||
../../gno/usr.bin/awk/tests/out/out.1.4
|
||||
../../gno/usr.bin/awk/tests/out/out.2.1
|
||||
../../gno/usr.bin/awk/tests/out/out.2.2
|
||||
../../gno/usr.bin/awk/tests/out/out.2.3
|
||||
../../gno/usr.bin/awk/tests/out/out.2.4
|
||||
../../gno/usr.bin/awk/tests/out/out.3.1
|
||||
../../gno/usr.bin/awk/tests/out/out.8.1
|
||||
../../gno/usr.bin/dirname/dirname.1
|
||||
../../gno/sbin/reboot/boot.hp300.8
|
||||
../../gno/sbin/reboot/boot.i386.8
|
||||
../../gno/sbin/reboot/boot.sparc.8
|
||||
../../gno/sbin/reboot/boot.tahoe.8
|
||||
../../gno/sbin/reboot/boot.vax.8
|
||||
../../gno/usr.man/man3/getcap.3
|
||||
../../gno/usr.sbin/cron/cron.8
|
||||
../../gno/usr.sbin/inetd/inetd.8
|
607
man/man2html
Executable file
607
man/man2html
Executable file
@ -0,0 +1,607 @@
|
||||
#!/usr/bin/perl
|
||||
##---------------------------------------------------------------------------##
|
||||
## File:
|
||||
## @(#) man2html 1.2 97/08/12 12:57:30 @(#)
|
||||
## Author:
|
||||
## Earl Hood, ehood@medusa.acs.uci.edu
|
||||
## Description:
|
||||
## man2html is a Perl program to convert formatted nroff output
|
||||
## to HTML.
|
||||
##
|
||||
## Recommend command-line options based on platform:
|
||||
##
|
||||
## Platform Options
|
||||
## ---------------------------------------------------------------------
|
||||
## c2mp <None, the defaults should be okay>
|
||||
## hp9000s700/800 -leftm 1 -topm 8
|
||||
## sun4 -sun
|
||||
## ---------------------------------------------------------------------
|
||||
##
|
||||
##---------------------------------------------------------------------------##
|
||||
## Copyright (C) 1995-1997 Earl Hood, ehood@medusa.acs.uci.edu
|
||||
##
|
||||
## 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 of the License, 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
|
||||
##---------------------------------------------------------------------------##
|
||||
|
||||
package Man2Html;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
($PROG = $0) =~ s/.*\///;
|
||||
$VERSION = "3.0.1";
|
||||
|
||||
## Input and outputs filehandles
|
||||
$InFH = \*STDIN unless $InFH;
|
||||
$OutFH = \*STDOUT unless $OutFH;
|
||||
|
||||
## Backspace character: Used in overstriking detection
|
||||
*bs = \"\b";
|
||||
|
||||
## Hash of section titles and their HTML tag wrapper.
|
||||
## This list allows customization of what HTML tag is used for
|
||||
## a given section head.
|
||||
##
|
||||
## The section title can be a regular expression. Therefore, one must
|
||||
## be careful about quoting special characters.
|
||||
##
|
||||
%SectionHead = (
|
||||
|
||||
'\S.*OPTIONS.*' => '<H2>',
|
||||
'AUTHORS?' => '<H2>',
|
||||
'BUGS' => '<H2>',
|
||||
'COMPATIBILITY' => '<H2>',
|
||||
'DEPENDENCIES' => '<H2>',
|
||||
'DESCRIPTION' => '<H2>',
|
||||
'DIAGNOSTICS' => '<H2>',
|
||||
'ENVIRONMENT' => '<H2>',
|
||||
'ERRORS' => '<H2>',
|
||||
'EXAMPLES' => '<H2>',
|
||||
'EXTERNAL INFLUENCES' => '<H2>',
|
||||
'FILES' => '<H2>',
|
||||
'LIMITATIONS' => '<H2>',
|
||||
'NAME' => '<H2>',
|
||||
'NOTES?' => '<H2>',
|
||||
'OPTIONS' => '<H2>',
|
||||
'REFERENCES' => '<H2>',
|
||||
'RETURN VALUE' => '<H2>',
|
||||
'SECTION.*:' => '<H2>',
|
||||
'SEE ALSO' => '<H2>',
|
||||
'STANDARDS CONFORMANCE' => '<H2>',
|
||||
'STYLE CONVENTION' => '<H2>',
|
||||
'SYNOPSIS' => '<H2>',
|
||||
'SYNTAX' => '<H2>',
|
||||
'WARNINGS' => '<H2>',
|
||||
'\s+Section.*:' => '<H3>',
|
||||
|
||||
);
|
||||
|
||||
## Fallback tag if above is not found
|
||||
$HeadFallback = '<H2>';
|
||||
|
||||
## Other gobals
|
||||
|
||||
$Bare = 0; # Skip printing HTML head/foot flag
|
||||
$BTag = 'B'; # Overstrike tag
|
||||
$CgiUrl = ''; # CGI URL expression
|
||||
$Compress = 0; # Do blank line compression flag
|
||||
$K = 0; # Do keyword search processing flag
|
||||
$NoDepage = 0; # Do not strip page information
|
||||
$NoHeads = 0; # Do no header detection flag
|
||||
$SeeAlso = 0; # Do only SEE ALSO xrefs flag
|
||||
$Solaris = 0; # Solaris keyword search processing flag
|
||||
$Sun = 0; # Headers not overstriken flag
|
||||
$Title = ''; # Title
|
||||
$UTag = 'I'; # Underline tag
|
||||
$ftsz = 7; # Bottome margin size
|
||||
$hdsz = 7; # Top margin size
|
||||
$leftm = ''; # Left margin pad
|
||||
$leftmsz = 0; # Left margin size
|
||||
$pgsz = 66; # Size of page size
|
||||
$txsz = 52; # Text body length size
|
||||
|
||||
#############################################################################
|
||||
## Main Block
|
||||
#############################################################################
|
||||
{
|
||||
if (get_cli_opts()) {
|
||||
if ($K) {
|
||||
man_k();
|
||||
} else {
|
||||
do_it();
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
## Subroutines
|
||||
#############################################################################
|
||||
|
||||
sub do_it {
|
||||
|
||||
## Define while loop and then eval it when used. The reason
|
||||
## is to avoid the regular expression reevaulation in the
|
||||
## section head detection code.
|
||||
|
||||
$doitcode =<<'EndOfDoItCode';
|
||||
|
||||
my($line, $tmp, $i, $head, $preindent, $see_also, $do);
|
||||
|
||||
$see_also = !$SeeAlso;
|
||||
print $OutFH "<!-- Manpage converted by man2html $VERSION -->\n";
|
||||
LOOP: while(!eof($InFH)) {
|
||||
$blank = 0;
|
||||
for ($i=0; $i < $hdsz; $i++) {
|
||||
last LOOP unless defined($_ = <$InFH>);
|
||||
}
|
||||
for ($i=0; $i < $txsz; $i++) {
|
||||
last LOOP unless defined($_ = <$InFH>);
|
||||
|
||||
## Check if compress consecutive blank lines
|
||||
if ($Compress and !/\S/) {
|
||||
if ($blank) { next; } else { $blank = 1; }
|
||||
} else {
|
||||
$blank = 0;
|
||||
}
|
||||
|
||||
## Try to check if line space is needed at page boundaries ##
|
||||
if (!$NoDepage && ($i==0 || $i==($txsz-1)) && !/^\s*$/) {
|
||||
/^(\s*)/; $tmp = length($1);
|
||||
if ($do) {
|
||||
if ($tmp < $preindent) { print $OutFH "\n"; }
|
||||
} else {
|
||||
$do = 1;
|
||||
}
|
||||
$preindent = $tmp;
|
||||
} else {
|
||||
$do = 0; $preindent = 0;
|
||||
}
|
||||
|
||||
## Interpret line
|
||||
$line = $_;
|
||||
entitize(\$_); # Convert [$<>] to entity references
|
||||
|
||||
## Check for 'SEE ALSO' link only
|
||||
if (!$see_also && $CgiUrl && $SeeAlso) {
|
||||
($tmp = $line) =~ s/.\010//go;
|
||||
if ($tmp =~ /^\s*SEE\s+ALSO\s*$/o) { $see_also = 1; }
|
||||
else { $see_also = 0; }
|
||||
}
|
||||
|
||||
## Create anchor links for manpage references
|
||||
s/((((.\010)+)?[\+_\.\w-])+\(((.\010)+)?
|
||||
\d((.\010)+)?\w?\))
|
||||
/make_xref($1)
|
||||
/geox if $see_also;
|
||||
|
||||
## Emphasize underlined words
|
||||
# s/((_\010[^_])+[\.\(\)_]?(_\010[^_])+\)?)/emphasize($1)/oge;
|
||||
# s/((_\010[^_])+([\.\(\)_]?(_\010[^_])+)?)/emphasize($1)/oge;
|
||||
#
|
||||
# The previous expressions were trying to be clever about
|
||||
# detecting underlined text which contain non-alphanumeric
|
||||
# characters. nroff will not underline non-alphanumeric
|
||||
# characters in an underlined phrase, and the above was trying
|
||||
# to detect that. It does not work all the time, and it
|
||||
# screws up other text, so a simplified expression is used.
|
||||
|
||||
s/((_\010[^_])+)/emphasize($1)/oge;
|
||||
|
||||
$secth = 0;
|
||||
## Check for strong text and headings
|
||||
if ($Sun || /.\010./o) {
|
||||
if (!$NoHeads) {
|
||||
$line =~ s/.\010//go;
|
||||
$tmp = $HeadFallback;
|
||||
EndOfDoItCode
|
||||
|
||||
## Create switch statement for detecting a heading
|
||||
##
|
||||
$doitcode .= "HEADSW: {\n";
|
||||
foreach $head (keys %SectionHead) {
|
||||
$doitcode .= join("", "\$tmp = '$SectionHead{$head}', ",
|
||||
"\$secth = 1, last HEADSW ",
|
||||
"if \$line =~ /^$leftm$head/o;\n");
|
||||
}
|
||||
$doitcode .= "}\n";
|
||||
|
||||
## Rest of routine
|
||||
##
|
||||
$doitcode .=<<'EndOfDoItCode';
|
||||
if ($secth || $line =~ /^$leftm\S/o) {
|
||||
chop $line;
|
||||
$_ = $tmp . $line . $tmp;
|
||||
s%<([^>]*)>$%</$1>%;
|
||||
$_ = "\n</PRE>\n" . $_ . "<PRE>\n";
|
||||
} else {
|
||||
s/(((.\010)+.)+)/strongize($1)/oge;
|
||||
}
|
||||
} else {
|
||||
s/(((.\010)+.)+)/strongize($1)/oge;
|
||||
}
|
||||
}
|
||||
print $OutFH $_;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $ftsz; $i++) {
|
||||
last LOOP unless defined($_ = <$InFH>);
|
||||
}
|
||||
}
|
||||
EndOfDoItCode
|
||||
|
||||
|
||||
## Perform processing.
|
||||
|
||||
printhead() unless $Bare;
|
||||
print $OutFH "<PRE>\n";
|
||||
eval $doitcode; # $doitcode defined above
|
||||
print $OutFH "</PRE>\n";
|
||||
printtail() unless $Bare;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
sub get_cli_opts {
|
||||
return 0 unless
|
||||
GetOptions(
|
||||
"bare", # Leave out HTML, HEAD, BODY tags.
|
||||
"belem=s", # HTML Element for overstriked text (def: "B")
|
||||
"botm=i", # Number of lines for bottom margin (def: 7)
|
||||
"cgiurl=s", # CGI URL for linking to other manpages
|
||||
"cgiurlexp=s", # CGI URL Perl expr for linking to other manpages
|
||||
"compress", # Compress consecutive blank lines
|
||||
"headmap=s", # Filename of user section head map file
|
||||
"k", # Process input from 'man -k' output.
|
||||
"leftm=i", # Character width of left margin (def: 0)
|
||||
"nodepage", # Do not remove pagination lines
|
||||
"noheads", # Do not detect for section heads
|
||||
"pgsize=i", # Number of lines in a page (def: 66)
|
||||
"seealso", # Link to other manpages only in the SEE ALSO section
|
||||
"solaris", # Parse 'man -k' output from a solaris system
|
||||
"sun", # Section heads are not overstriked in input
|
||||
"title=s", # Title of manpage (def: Not defined)
|
||||
"topm=i", # Number of lines for top margin (def: 7)
|
||||
"uelem=s", # HTML Element for underlined text (def: "I")
|
||||
|
||||
"help" # Short usage message
|
||||
);
|
||||
return 0 if defined($opt_help);
|
||||
|
||||
$pgsz = $opt_pgsize || $pgsz;
|
||||
if (defined($opt_nodepage)) {
|
||||
$hdsz = 0;
|
||||
$ftsz = 0;
|
||||
} else {
|
||||
$hdsz = $opt_topm if defined($opt_topm);
|
||||
$ftsz = $opt_botm if defined($opt_botm);
|
||||
}
|
||||
$txsz = $pgsz - ($hdsz + $ftsz);
|
||||
$leftmsz = $opt_leftm if defined($opt_leftm);
|
||||
$leftm = ' ' x $leftmsz;
|
||||
|
||||
$Bare = defined($opt_bare);
|
||||
$Compress = defined($opt_compress);
|
||||
$K = defined($opt_k);
|
||||
$NoDepage = defined($opt_nodepage);
|
||||
$NoHeads = defined($opt_noheads);
|
||||
$SeeAlso = defined($opt_seealso);
|
||||
$Solaris = defined($opt_solaris);
|
||||
$Sun = defined($opt_sun);
|
||||
|
||||
$Title = $opt_title || $Title;
|
||||
$CgiUrl = $opt_cgiurlexp ||
|
||||
($opt_cgiurl ? qq{return "$opt_cgiurl"} : '');
|
||||
|
||||
$BTag = $opt_belem || $BTag;
|
||||
$UTag = $opt_uelem || $UTag;
|
||||
$BTag =~ s/[<>]//g;
|
||||
$UTag =~ s/[<>]//g;
|
||||
|
||||
if (defined($opt_headmap)) {
|
||||
require $opt_headmap or warn "Unable to read $opt_headmap\n";
|
||||
}
|
||||
1;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
sub printhead {
|
||||
print $OutFH "<HTML>\n";
|
||||
print $OutFH "<HEAD>\n",
|
||||
"<TITLE>$Title</TITLE>\n",
|
||||
"</HEAD>\n" if $Title;
|
||||
print $OutFH "<BODY>\n";
|
||||
print $OutFH "<H1>$Title</H1>\n",
|
||||
"<HR>\n" if $Title;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
sub printtail {
|
||||
print $OutFH <<EndOfRef;
|
||||
<HR>
|
||||
<ADDRESS>
|
||||
Man(1) output converted with
|
||||
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
|
||||
</ADDRESS>
|
||||
</BODY>
|
||||
</HTML>
|
||||
EndOfRef
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
sub emphasize {
|
||||
my($txt) = shift;
|
||||
$txt =~ s/.\010//go;
|
||||
$txt = "<$UTag>$txt</$UTag>";
|
||||
$txt;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
sub strongize {
|
||||
my($txt) = shift;
|
||||
$txt =~ s/.\010//go;
|
||||
$txt = "<$BTag>$txt</$BTag>";
|
||||
$txt;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
sub entitize {
|
||||
my($txt) = shift;
|
||||
|
||||
## Check for special characters in overstrike text ##
|
||||
$$txt =~ s/_\010\&/strike('_', '&')/geo;
|
||||
$$txt =~ s/_\010</strike('_', '<')/geo;
|
||||
$$txt =~ s/_\010>/strike('_', '>')/geo;
|
||||
|
||||
$$txt =~ s/(\&\010)+\&/strike('&', '&')/geo;
|
||||
$$txt =~ s/(<\010)+</strike('<', '<')/geo;
|
||||
$$txt =~ s/(>\010)+>/strike('>', '>')/geo;
|
||||
|
||||
## Check for special characters in regular text. Must be careful
|
||||
## to check before/after character in expression because it might be
|
||||
## a special character.
|
||||
$$txt =~ s/([^\010]\&[^\010])/htmlize2($1)/geo;
|
||||
$$txt =~ s/([^\010]<[^\010])/htmlize2($1)/geo;
|
||||
$$txt =~ s/([^\010]>[^\010])/htmlize2($1)/geo;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
## escape special characters in a string, in-place
|
||||
##
|
||||
sub htmlize {
|
||||
my($str) = shift;
|
||||
$$str =~ s/&/\&/g;
|
||||
$$str =~ s/</\</g;
|
||||
$$str =~ s/>/\>/g;
|
||||
$$str;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
## htmlize2() is used by entitize.
|
||||
##
|
||||
sub htmlize2 {
|
||||
my($str) = shift;
|
||||
$str =~ s/&/\&/g;
|
||||
$str =~ s/</\</g;
|
||||
$str =~ s/>/\>/g;
|
||||
$str;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
## strike converts HTML special characters in overstriked text
|
||||
## into entity references. The entities are overstriked so
|
||||
## strongize() and emphasize() will recognize the entity to be
|
||||
## wrapped in tags.
|
||||
##
|
||||
sub strike {
|
||||
my($w, $char) = @_;
|
||||
my($ret);
|
||||
if ($w eq '_') {
|
||||
if ($char eq '&') {
|
||||
$ret = "_$bs\&_${bs}a_${bs}m_${bs}p_${bs};";
|
||||
} elsif ($char eq '<') {
|
||||
$ret = "_$bs\&_${bs}l_${bs}t_${bs};";
|
||||
} elsif ($char eq '>') {
|
||||
$ret = "_$bs\&_${bs}g_${bs}t_${bs};";
|
||||
} else {
|
||||
warn qq|Unrecognized character, "$char", passed to strike()\n|;
|
||||
}
|
||||
} else {
|
||||
if ($char eq '&') {
|
||||
$ret = "\&$bs\&a${bs}am${bs}mp${bs}p;${bs};";
|
||||
} elsif ($char eq '<') {
|
||||
$ret = "\&$bs\&l${bs}lt${bs}t;${bs};";
|
||||
} elsif ($char eq '>') {
|
||||
$ret = "\&$bs\&g${bs}gt${bs}t;${bs};";
|
||||
} else {
|
||||
warn qq|Unrecognized character, "$char", passed to strike()\n|;
|
||||
}
|
||||
}
|
||||
$ret;
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
## make_xref() converts a manpage crossreference into a hyperlink.
|
||||
##
|
||||
sub make_xref {
|
||||
my $str = shift;
|
||||
$str =~ s/.\010//go; # Remove overstriking
|
||||
|
||||
if ($CgiUrl) {
|
||||
my($title,$section,$subsection) =
|
||||
($str =~ /([\+_\.\w-]+)\((\d)(\w?)\)/);
|
||||
|
||||
$title =~ s/\+/%2B/g;
|
||||
my($href) = (eval $CgiUrl);
|
||||
qq|<B><A HREF="$href">$str</A></B>|;
|
||||
} else {
|
||||
qq|<B>$str</B>|;
|
||||
}
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
## man_k() process a keyword search. The problem we have is there
|
||||
## is no standard for keyword search results from man. Solaris
|
||||
## systems have a different enough format to warrent dealing
|
||||
## with it as a special case. For other cases, we try our best.
|
||||
## Unfortunately, there are some lines of results that may be
|
||||
## skipped.
|
||||
##
|
||||
sub man_k {
|
||||
my($line,$refs,$section,$subsection,$desc,$i,
|
||||
%Sec1, %Sec1sub, %Sec2, %Sec2sub, %Sec3, %Sec3sub,
|
||||
%Sec4, %Sec4sub, %Sec5, %Sec5sub, %Sec6, %Sec6sub,
|
||||
%Sec7, %Sec7sub, %Sec8, %Sec8sub, %Sec9, %Sec9sub,
|
||||
%SecN, %SecNsub, %SecNsec);
|
||||
|
||||
printhead() unless $Bare;
|
||||
print $OutFH "<!-- Man keyword results converted by ",
|
||||
"man2html $VERSION -->\n";
|
||||
|
||||
while ($line = <$InFH>) {
|
||||
next if $line !~ /\(\d\w?\)\s+-\s/; # check if line can be handled
|
||||
($refs,$section,$subsection,$desc) =
|
||||
$line =~ /^\s*(.*)\((\d)(\w?)\)\s*-\s*(.*)$/;
|
||||
|
||||
if ($Solaris) {
|
||||
$refs =~ s/^\s*([\+_\.\w-]+)\s+([\+_\.\w-]+)\s*$/$1/;
|
||||
# <topic> <manpage>
|
||||
} else {
|
||||
$refs =~ s/\s(and|or)\s/,/gi; # Convert and/or to commas
|
||||
$refs =~ s/^[^:\s]:\s*//; # Remove prefixed whatis path
|
||||
}
|
||||
$refs =~ s/\s//g; # Remove all whitespace
|
||||
$refs =~ s/,/, /g; # Put space after comma
|
||||
htmlize(\$desc); # Check for special chars in desc
|
||||
$desc =~ s/^(.)/\U$1/; # Uppercase first letter in desc
|
||||
|
||||
if ($section eq '1') {
|
||||
$Sec1{$refs} = $desc; $Sec1sub{$refs} = $subsection;
|
||||
} elsif ($section eq '2') {
|
||||
$Sec2{$refs} = $desc; $Sec2sub{$refs} = $subsection;
|
||||
} elsif ($section eq '3') {
|
||||
$Sec3{$refs} = $desc; $Sec3sub{$refs} = $subsection;
|
||||
} elsif ($section eq '4') {
|
||||
$Sec4{$refs} = $desc; $Sec4sub{$refs} = $subsection;
|
||||
} elsif ($section eq '5') {
|
||||
$Sec5{$refs} = $desc; $Sec5sub{$refs} = $subsection;
|
||||
} elsif ($section eq '6') {
|
||||
$Sec6{$refs} = $desc; $Sec6sub{$refs} = $subsection;
|
||||
} elsif ($section eq '7') {
|
||||
$Sec7{$refs} = $desc; $Sec7sub{$refs} = $subsection;
|
||||
} elsif ($section eq '8') {
|
||||
$Sec8{$refs} = $desc; $Sec8sub{$refs} = $subsection;
|
||||
} elsif ($section eq '9') {
|
||||
$Sec9{$refs} = $desc; $Sec9sub{$refs} = $subsection;
|
||||
} else { # Catch all
|
||||
$SecN{$refs} = $desc; $SecNsec{$refs} = $section;
|
||||
$SecNsub{$refs} = $subsection;
|
||||
}
|
||||
}
|
||||
print_mank_sec(\%Sec1, 1, \%Sec1sub);
|
||||
print_mank_sec(\%Sec2, 2, \%Sec2sub);
|
||||
print_mank_sec(\%Sec3, 3, \%Sec3sub);
|
||||
print_mank_sec(\%Sec4, 4, \%Sec4sub);
|
||||
print_mank_sec(\%Sec5, 5, \%Sec5sub);
|
||||
print_mank_sec(\%Sec6, 6, \%Sec6sub);
|
||||
print_mank_sec(\%Sec7, 7, \%Sec7sub);
|
||||
print_mank_sec(\%Sec8, 8, \%Sec8sub);
|
||||
print_mank_sec(\%Sec9, 9, \%Sec9sub);
|
||||
print_mank_sec(\%SecN, 'N', \%SecNsub, \%SecNsec);
|
||||
|
||||
printtail() unless $Bare;
|
||||
}
|
||||
##---------------------------------------------------------------------------
|
||||
## print_mank_sec() prints out manpage cross-refs of a specific section.
|
||||
##
|
||||
sub print_mank_sec {
|
||||
my($sec, $sect, $secsub, $secsec) = @_;
|
||||
my(@array, @refs, $href, $item, $title, $subsection, $i, $section,
|
||||
$xref);
|
||||
$section = $sect;
|
||||
|
||||
@array = sort keys %$sec;
|
||||
if ($#array >= 0) {
|
||||
print $OutFH "<H2>Section $section</H2>\n",
|
||||
"<DL COMPACT>\n";
|
||||
foreach $item (@array) {
|
||||
@refs = split(/,/, $item);
|
||||
$section = $secsec->{$item} if $sect eq 'N';
|
||||
$subsection = $secsub->{$item};
|
||||
if ($CgiUrl) {
|
||||
($title = $refs[0]) =~ s/\(\)//g; # watch out for extra ()'s
|
||||
$xref = eval $CgiUrl;
|
||||
}
|
||||
print $OutFH "<DT>\n";
|
||||
$i = 0;
|
||||
foreach (@refs) {
|
||||
if ($CgiUrl) {
|
||||
print $OutFH qq|<B><A HREF="$xref">$_</A></B>|;
|
||||
} else {
|
||||
print $OutFH $_;
|
||||
}
|
||||
print $OutFH ", " if $i < $#refs;
|
||||
$i++;
|
||||
}
|
||||
print $OutFH " ($section$subsection)\n",
|
||||
"</DT><DD>\n",
|
||||
$sec->{$item}, "</DD>\n";
|
||||
}
|
||||
print $OutFH "</DL>\n";
|
||||
}
|
||||
}
|
||||
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
sub usage {
|
||||
print $OutFH <<EndOfUsage;
|
||||
Usage: $PROG [ options ] < infile > outfile
|
||||
Options:
|
||||
-bare : Do not put in HTML, HEAD, BODY tags
|
||||
-belem <elem> : HTML Element for overstriked text (def: "B")
|
||||
-botm <#> : Number of lines for bottom margin (def: 7)
|
||||
-cgiurl <url> : URL for linking to other manpages
|
||||
-cgiurlexp <url> : Perl expression URL for linking to other manpages
|
||||
-compress : Compress consective blank lines
|
||||
-headmap <file> : Filename of user section head map file
|
||||
-help : This message
|
||||
-k : Process a keyword search result
|
||||
-leftm <#> : Character width of left margin (def: 0)
|
||||
-nodepage : Do not remove pagination lines
|
||||
-noheads : Turn off section head detection
|
||||
-pgsize <#> : Number of lines in a page (def: 66)
|
||||
-seealso : Link to other manpages only in the SEE ALSO section
|
||||
-solaris : Process keyword search result in Solaris format
|
||||
-sun : Section heads are not overstriked in input
|
||||
-title <string> : Title of manpage (def: Not defined)
|
||||
-topm <#> : Number of lines for top margin (def: 7)
|
||||
-uelem <elem> : HTML Element for underlined text (def: "I")
|
||||
|
||||
Description:
|
||||
$PROG takes formatted manpages from STDIN and converts it to HTML sent
|
||||
to STDOUT. The -topm and -botm arguments are the number of lines to the
|
||||
main body text and NOT to the running headers/footers.
|
||||
|
||||
Version:
|
||||
$VERSION
|
||||
Copyright (C) 1995-1997 Earl Hood, ehood\@medusa.acs.uci.edu
|
||||
$PROG comes with ABSOLUTELY NO WARRANTY and $PROG may be copied only
|
||||
under the terms of the GNU General Public License, which may be found in
|
||||
the $PROG distribution.
|
||||
|
||||
EndOfUsage
|
||||
exit 0;
|
||||
}
|
93
man/mkhtmlman
Executable file
93
man/mkhtmlman
Executable file
@ -0,0 +1,93 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Devin Reade, November 1997.
|
||||
#
|
||||
# $Id: mkhtmlman,v 1.9 1999/02/21 23:37:13 gdr-ftp Exp $
|
||||
|
||||
man2html=./man2html
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
|
||||
#
|
||||
# Make sure we know where everything is going.
|
||||
#
|
||||
if [ -z "$GNOROOT" ]; then
|
||||
# This is where the main GNO source tree is located
|
||||
echo "GNOROOT variable not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$MANHTML" ]; then
|
||||
echo "MANHTML variable not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$NAME" ]; then
|
||||
echo "NAME variable not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$ADDR" ]; then
|
||||
echo "ADDR variable not set"
|
||||
exit 1
|
||||
fi
|
||||
#if [ ! -x ./newer ]; then
|
||||
# echo "./newer does not exist"
|
||||
# exit 1
|
||||
#fi
|
||||
set +e
|
||||
|
||||
listfile=$TMPDIR/mkhtmlman.1.$$
|
||||
|
||||
trap "rm -f $listfile" 0 1 2 15
|
||||
|
||||
MANDIRS="$GNOROOT/usr.man $GNOROOT/*bin* $GNOROOT/*lib*"
|
||||
|
||||
for section in 1 2 3 4 5 6 7 8; do
|
||||
dest=$MANHTML/man$section
|
||||
[ -d $dest ] || mkdir -p $dest
|
||||
|
||||
for F in 00.DUMMY `find $MANDIRS -type f -name '*.'$section -print \
|
||||
| grep -v .AppleDouble \
|
||||
| grep -v .finderinfo \
|
||||
| grep -v .resource \
|
||||
| grep -v libcurses/PSD.doc \
|
||||
| grep -v bin/gsh/updates1.1 \
|
||||
| grep -v sed/tests` ; do
|
||||
[ "$F" = 00.DUMMY ] && continue;
|
||||
if egrep -q -e '^'"$F"'$' ignored.pages; then
|
||||
# echo "$F: ignored"
|
||||
continue
|
||||
fi
|
||||
F_noG="$F"
|
||||
if [ -f $F'G' ]; then
|
||||
F="$F"G
|
||||
fi
|
||||
macro=''
|
||||
if ! egrep -q -e '^\.TH.*GNO' $F; then
|
||||
if egrep -q -e '^\.Sh NAME' $F; then
|
||||
echo "$F: Using the BSD-formatted man page."
|
||||
macro=doc
|
||||
else
|
||||
echo "$F: This does not appear to be a GNO manual page." \
|
||||
"Skipped."
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
f=`basename $F_noG`
|
||||
f2=`echo $f | perl -pe 's/\.[^\.]+$//;'`
|
||||
echo "$f" >> $listfile
|
||||
if [ ! $dest/$f.html -nt $F ]; then
|
||||
echo "creating $dest/$f.html"
|
||||
# nroff -man$macro $F | col -b > $dest/$f.txt
|
||||
nroff -man$macro $F | $man2html -nodepage | \
|
||||
perl -p -e \
|
||||
's/<BODY>/<title>GNO: '"$f2($section)"'<\/title><body bgcolor=\#ffffff textcolor=\#000000 linkcolor=\#0000FF vlinkcolor=\#001177 alinkcolor=\#001177>/;'\
|
||||
> $dest/$f.html
|
||||
chmod 0644 $dest/$f.html
|
||||
fi
|
||||
done
|
||||
echo "creating $dest/00.index.html"
|
||||
sort $listfile | \
|
||||
./mkmandex -s$section -name="$NAME" -addr="$ADDR" -mkso="$MKSO" \
|
||||
-hroot="../.." > $dest/00.index.html
|
||||
chmod 0644 $dest/00.index.html
|
||||
rm $listfile
|
||||
done
|
||||
|
167
man/mkmandex
Executable file
167
man/mkmandex
Executable file
@ -0,0 +1,167 @@
|
||||
#! /usr/bin/perl -s
|
||||
#
|
||||
# This creates an index page for the man pages of a given chapter.
|
||||
# Usage:
|
||||
# ls -1 file_list | mkmandex -sSection -name="maintainter name" \
|
||||
# -address="maintainer email address"
|
||||
#
|
||||
# Devin Reade, November 1997.
|
||||
#
|
||||
|
||||
# initialize and check usage
|
||||
$sec='';
|
||||
defined($s1) && ($num = '1') && ($sec = "Commands and Applications");
|
||||
defined($s2) && ($num = '2') && ($sec = "System Calls");
|
||||
defined($s3) && ($num = '3') && ($sec = "Library Routines");
|
||||
defined($s3f) && ($num = '3f') && ($sec = "Fortran Routines");
|
||||
defined($s4) && ($num = '4') && ($sec = "Devices");
|
||||
defined($s5) && ($num = '5') && ($sec = "File Formats");
|
||||
defined($s6) && ($num = '6') && ($sec = "Games");
|
||||
defined($s7) && ($num = '7') && ($sec = "Miscellaneous");
|
||||
defined($s8) && ($num = '8') && ($sec = "System Administration");
|
||||
|
||||
($sec eq '') && die("section number not specified");
|
||||
defined($name) || die("-name flag not specified");
|
||||
defined($addr) || die("-addr flag not specified");
|
||||
defined($hroot) || die("-hroot flag not specified");
|
||||
|
||||
# $hdir = $hroot . '/man/man' . $num . '/';
|
||||
$hdir = $hroot . '/man/';
|
||||
|
||||
# print out the head of the page
|
||||
printf("<html>\n" .
|
||||
"<head>\n" .
|
||||
"<!-- This document autogenerated from mkmandex -->\n".
|
||||
'<!-- $Id: mkmandex,v 1.2 1999/02/21 23:37:13 gdr-ftp Exp $ -->' . "\n" .
|
||||
"<title>Chapter %s: %s</title>\n" .
|
||||
"</head>\n" .
|
||||
"<body " .
|
||||
"bgcolor=\#ffffff " .
|
||||
"textcolor=\#000000 " .
|
||||
"linkcolor=\#0000FF " .
|
||||
"vlinkcolor=\#001177 " .
|
||||
"alinkcolor=\#001177 " .
|
||||
">\n" .
|
||||
"<h1>Chapter %s: %s</h1>\n" .
|
||||
"<pre>\n",
|
||||
$num, $sec, $num, $sec);
|
||||
|
||||
# get the list of files
|
||||
$maxlen = 0;
|
||||
while(<>) {
|
||||
chop;
|
||||
$pagename = $file = $_;
|
||||
$pagename =~ s/\.\df?$//;
|
||||
$filelist{$pagename} = "man$num/$file";
|
||||
$len = length($pagename);
|
||||
($len > $maxlen) && ($maxlen = $len);
|
||||
}
|
||||
|
||||
|
||||
# add in the appropriate .so links
|
||||
if (defined($mkso)) {
|
||||
open(infp, "< $mkso") || die("couldn't open $mkso");
|
||||
while ($_ = <infp>) {
|
||||
s/\#.*//;
|
||||
(/^\s*$/) && next;
|
||||
|
||||
if (/^\s*(\S+)\s+(\S+)\s*$/) {
|
||||
$real = $1;
|
||||
$link = $2;
|
||||
$link =~ s,.*/,,;
|
||||
if ($link =~ /(\df?)$/) {
|
||||
$suffix = $1;
|
||||
if ($suffix eq $num) {
|
||||
# if ($real =~ m,(.*)/,) {
|
||||
# $prefix = $1;
|
||||
# if ($prefix eq "man$num") {
|
||||
# $real =~ s,.*/,,;
|
||||
# }
|
||||
# }
|
||||
$pagename = $link;
|
||||
$pagename =~ s/\.\df?$//;
|
||||
$filelist{$pagename} = $real;
|
||||
$len = length($pagename);
|
||||
($len > $maxlen) && ($maxlen = $len);
|
||||
}
|
||||
} else {
|
||||
printf(stderr "%s corrupt at line %d (1) real=%s\n",
|
||||
$mkso, $., $real);
|
||||
}
|
||||
} else {
|
||||
printf(stderr "%s corrupt at line %d (2)\n", $mkso, $.);
|
||||
}
|
||||
}
|
||||
close(infp);
|
||||
}
|
||||
|
||||
|
||||
$pagewidth = 70;
|
||||
$colwidth = $maxlen + 3;
|
||||
$columns = int($pagewidth / $colwidth);
|
||||
($columns == 0) && ($columns = 1);
|
||||
|
||||
# special-case the introduction page
|
||||
$intro = 'intro';
|
||||
if (defined($filelist{$intro})) {
|
||||
printf("<A HREF=\"%s%s.html\">%s</A> (Chapter Introduction)\n\n",
|
||||
$hdir, $filelist{$intro}, $intro);
|
||||
undef($filelist{$intro});
|
||||
}
|
||||
|
||||
@keylist = sort(keys(%filelist));
|
||||
|
||||
# put everything into neat columns
|
||||
undef(@rows);
|
||||
$maxrow = 0;
|
||||
$entries = scalar(@keylist);
|
||||
$maxrow = int($entries / $columns);
|
||||
(($entries % $columns) == 0) || ($maxrow++);
|
||||
while (scalar(@keylist) > 0) {
|
||||
for ($i=0; ($i<$maxrow) && (scalar(@keylist) > 0); $i++) {
|
||||
$k = shift(@keylist);
|
||||
if ($k eq $intro) {
|
||||
$i--;
|
||||
next;
|
||||
}
|
||||
$padding = $colwidth - length($k);
|
||||
$rows[$i] .= '<A HREF="' . $hdir . $filelist{$k} . '.html">'
|
||||
. $k . '</A>';
|
||||
for ($j = 0; $j < $padding; $j++) {
|
||||
$rows[$i] .= ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# print them out
|
||||
for ($i=0; $i<$maxrow; $i++) {
|
||||
printf("%s\n", $rows[$i]);
|
||||
}
|
||||
|
||||
|
||||
if (0) {
|
||||
|
||||
die('oh shit');
|
||||
while (scalar(@keylist) > 0) {
|
||||
for ($i=0; ($i<$columns) && (scalar(@keylist) > 0); $i++) {
|
||||
$k = shift(@keylist);
|
||||
$padding = $colwidth - length($k);
|
||||
printf("<A HREF=\"%s\">%s</A>", $filelist{$k}, $k);
|
||||
for ($j = 0; $j < $padding; $j++) {
|
||||
print ' ';
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
# printf("<A HREF=\"%s\">%s</A><br>\n", $_, $_);
|
||||
|
||||
# print out the tail of the page
|
||||
printf("</pre>\n" .
|
||||
"<hr>\n".
|
||||
"%s\n" .
|
||||
"<A HREF=\"mailto:%s\"><%s></A>\n" .
|
||||
"</body>\n".
|
||||
"</html>\n",
|
||||
$name, $addr, $addr);
|
Loading…
Reference in New Issue
Block a user