man2htmlのヘルプ・マニュアル
日本語 英語
man2html --help
Content-type: text/html
man2html: bad invocation
man2html: bad invocation
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
Content-type: text/html
man2html: bad invocation
man2html: bad invocation
Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]
or: man2html -r [filename]
man man2html
man2html(1) man2html(1)
名前
man2html - マニュアルページを整形して html にする
書式
man2html [options] [file]
説明
man2html は file として指定されたファイル (ファイル引き数がなかったり、
"-" が指定された場合は標準入力) を変換して、 man スタイルの nroff か ら
html を生成し、結果を標準出力に表示します。 tbl はサポートしていますが
eqn はしていません。返り値は常に 0 です。なにか問題が起こった場合は、エ
ラーページが標準出力に表示されます。
こ れはスタンドアローンのユーティリティとしても使えますが、主な目的は、
ユーザーが man ページを lynx(1), xmosaic(1), netscape(1) などの html ブ
ラウザを用いて見ることができるようにするための補助をすることです。
man2html の主要部は Richard Verhoeven (rcb5@win.tue.nl) によって書かれ
た troff-to-html エンジンです。これは以下のような形式のハイパーリンクを
付加します。
foo(3x) "http://localhost/cgi-bin/man/man2html?3x+foo"
method://string "method://string"
www.host.name "http://www.host.name"
ftp.host.name "ftp://ftp.host.name"
name@host "mailto:name@host"
"file:/usr/include/string.h"
(最初のリンクはオプションによって変更できます - 以下の記述を参照のこと)
リンク先の確認は行われず、リンク先が存在していなくてもリンク行が生成 さ
れ ます。文書内部での、セクションなどへのハイパーリンクも生成されます。
したがって bash(1) などの大きなマン・ページで必要な部分を探すのが楽にな
ります。
オプション
標準入力から読み込むとき、 .so の展開に関してはっきりしない場合もありま
す。 -D オプションを用いれば、スクリプトからワーキングディレクトリを 指
定することができます。
-D pathname
pathname の 最 後 の 二 つ 分 を取り除き、変換を行う前にそこに
chdir(dir) します。
-E オプションを用いると cgi スクリプトから簡単にエラーメッセージを生 成
することができます。
-E string
与えられたエラーメッセージを含むエラーページを出力します。
参 照先がマン・ページであるハイパーリンク、一般に以下のような形式で生成
されます。
デフォルトは上の通りですが、ハイパーリンクの各部は各種オプションを用 い
ることでいろいろ設定できます。
-h method:cgipath を http://localhost にします。デフォルトです。
-H host[.domain][:port]
method:cgipath を htttp://host.domain:port に設定します。
-l method:cgipath を lynxcgi:/home/httpd に設定します。
-L dir method:cgipath を lynxcgi:dir に設定します。
-M man2htmlpath
man2htmlpath を設定します。デフォルトは /cgi-bin/man/man2html で
す。
-p セパレーターを ’/’ に設定します。
-q セパレーターを ’?’ に設定します。デフォルトです。
httpd が稼動していないマシンでは、 lynx で lynxcgi を用いればマン・ペー
ジ を 閲覧することができます。 http デーモンが稼動している場合は、 lynx
でも他のブラウザでも閲覧できます。オプション -l (‘lynxcgi’ の意味) は前
者 を選択します。これを指定すると、デフォルトの cgipath は /home/httpd/
になります。
一般には cgi スクリプトは
/?
のようなかたちで呼ぶことができます。環境変数 PATH_INFO と QUERY_STRING
がそれぞれ と に設定されます。 lynxcgi は PATH_INFO
部分を扱うことができないので、デフォルトでは ‘?’ をセパレーターとするハ
イ パ ーリンクを生成することにしました。オプション ‘-p’ (‘path’ の意味)
は ’/’ をセパレーターにします。一方 ‘-q’ (‘query’ の意味) は ’?’ をセパ
レーターにします。
オプション -H host は (localhost の代わりに) 用いるホストを指定します。
環境変数 SERVER_NAME が設定されていれば、 cgi スクリプトから
man2html -H $SERVER_NAME
のように用いることができます。これによって、お使いのマシンを、マン・ ペ
ージを提供するサーバーのように動作させることができます。
バグ
多くの発見的手法 (heuristic) が用いられています。出力は常に完全であると
は限りません。 lynxcgi は、これをサポートするように選択して lynx をコン
パ イルしなければ動作しません。セキュリティ上の問題があるかもしれません
。
関連項目
lynx(1), man(1)
1 January 1998 man2html(1)
man2html(1) man2html(1)
NAME
man2html - format a manual page in html
SYNOPSIS
man2html [options] [file]
DESCRIPTION
man2html converts a manual page as found in file (or stdin, in case no
file argument, or the argument "-", is given) from man-style nroff into
html, and prints the result on stdout. It does support tbl but does
not know about eqn. The exit status is 0. If something goes wrong, an
error page is printed on stdout.
This can be used as a stand-alone utility, but is mainly intended as an
auxiliary, to enable users to browse their man pages using a html
browser like lynx(1), xmosaic(1) or netscape(1).
The main part of man2html is the troff-to-html engine written by
Richard Verhoeven (rcb5@win.tue.nl). It adds hyperlinks for the fol-
lowing constructs:
foo(3x) "http://localhost/cgi-bin/man/man2html?3x+foo"
method://string "method://string"
www.host.name "http://www.host.name"
ftp.host.name "ftp://ftp.host.name"
name@host "mailto:name@host"
"file:/usr/include/string.h"
(The first of these can be tuned by options - see below.) No lookup is
done - the links generated need not exist. Also an index with internal
hyperlinks to the various sections is generated, so that it is easier
to find one’s way in large man pages like bash(1).
OPTIONS
When reading from stdin, it is not always clear how to do .so expan-
sion. The -D option allows a script to define the working directory.
-D pathname
Strip the last two parts from the pathname, and do a chdir(dir)
before starting the conversion.
The -E option allows the easy generation of error messages from a cgi
script.
-E string
Output an error page containing the given error message.
-v or -V
Output page containing version information.
-f Unused, kept for backward compatibility.
The general form of a hyperlink generated for a man page reference is
with a default as shown above. The parts of this hyperlink are set
using the various options.
-h Set method:cgipath to http://localhost. This is the default.
-H host[.domain][:port]
Set method:cgipath to http://host.domain:port.
-l Set method:cgipath to lynxcgi:/home/httpd.
-L dir Set method:cgipath to lynxcgi:dir.
-M man2htmlpath
Set the man2htmlpath to use. The default is /cgi-
bin/man/man2html.
-p Set separator to ’/’.
-q Set separator to ’?’. This is the default.
-r Use relative html paths, instead of cgi-bin paths.
On a machine without running httpd, one can use lynx to browse the man
pages, using the lynxcgi method. When some http daemon is running,
lynx, or any other browser, can be used to browse the man pages, using
the http method. The option -l (for ‘lynxcgi’) selects the former
behaviour. With it, the default cgipath is /home/httpd.
In general, a cgi script can be called by
/?
and the environment variables PATH_INFO and QUERY_STRING will be set to
and , respectively. Since lynxcgi does not handle
the PATH_INFO part, we generate hyperlinks with ‘?’ as a separator by
default. The option -p (for ‘path’) selects ’/’ as a separator, while
the option -q (for ‘query’) selects ’?’ as a separator.
The option -H host will specify the host to use (instead of localhost).
A cgi script could use
man2html -H $SERVER_NAME
if the variable SERVER_NAME is set. This would allow your machine to
act as a server and export man pages.
BUGS
There are many heuristics. The output will not always be perfect. The
lynxcgi method will not work if lynx was compiled without selecting
support for it. There may be problems with security.
AUTHOR
Richard Verhoeven was the original author of man2html. Michael Hamil-
ton and Andries Brouwer subsequently improved on it. Federico
Lucifredi is the current maintainer.
SEE ALSO
lynx(1), man(1)
1 January 1998 man2html(1)