man-db.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-man-db" role="wrap">
  8. <?dbhtml filename="man-db.html"?>
  9. <sect1info condition="script">
  10. <productname>man-db</productname>
  11. <productnumber>&man-db-version;</productnumber>
  12. <address>&man-db-url;</address>
  13. </sect1info>
  14. <title>Man-DB-&man-db-version;</title>
  15. <indexterm zone="ch-system-man-db">
  16. <primary sortas="a-Man-DB">Man-DB</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>The Man-DB package contains programs for finding and viewing man
  21. pages.</para>
  22. <segmentedlist>
  23. <segtitle>&buildtime;</segtitle>
  24. <segtitle>&diskspace;</segtitle>
  25. <seglistitem>
  26. <seg>&man-db-ch6-sbu;</seg>
  27. <seg>&man-db-ch6-du;</seg>
  28. </seglistitem>
  29. </segmentedlist>
  30. </sect2>
  31. <sect2 role="installation">
  32. <title>Installation of Man-DB</title>
  33. <!-- <para>Two adjustments need to be made to the sources of Man-DB.</para>
  34. <para>The first change is a <command>sed</command> substitution to delete
  35. the <quote>/usr/man</quote> and <quote>/usr/local/man</quote> lines in
  36. the <filename>man_db.conf</filename> file to prevent redundant results
  37. when using programs such as <command>whatis</command>:</para> -->
  38. <para>LFS creates <filename>/usr/man</filename> and
  39. <filename>/usr/local/man</filename> as symlinks. Remove them from the
  40. <filename>man_db.conf</filename> file to prevent redundant
  41. results when using programs such as <command>whatis</command>:</para>
  42. <screen><userinput remap="pre">sed -i -e '\%\t/usr/man%d' -e '\%\t/usr/local/man%d' src/man_db.conf.in</userinput></screen>
  43. <para>Prepare Man-DB for compilation:</para>
  44. <screen><userinput remap="configure">./configure --prefix=/usr --libexecdir=/usr/lib \
  45. --sysconfdir=/etc --disable-setuid \
  46. --enable-mb-groff --with-browser=/usr/bin/lynx \
  47. --with-col=/usr/bin/col --with-vgrind=/usr/bin/vgrind \
  48. --with-grap=/usr/bin/grap</userinput></screen>
  49. <variablelist>
  50. <title>The meaning of the configure options:</title>
  51. <varlistentry>
  52. <term><parameter>--disable-setuid</parameter></term>
  53. <listitem>
  54. <para>This disables making the <command>man</command> program setuid
  55. to user <systemitem class="username">man</systemitem>.</para>
  56. </listitem>
  57. </varlistentry>
  58. <varlistentry>
  59. <term><parameter>--enable-mb-groff</parameter></term>
  60. <listitem>
  61. <para>This switch tells <application>man-db</application> to expect
  62. the Debian multibyte patched version of
  63. <application>groff</application>.</para>
  64. </listitem>
  65. </varlistentry>
  66. <varlistentry>
  67. <term><parameter>--with-...</parameter></term>
  68. <listitem>
  69. <para>These four parameters are used to set some default programs.
  70. The <command>col</command> program is a part of the Util-linux-ng
  71. package, <command>lynx</command> is a text-based web browser (see
  72. BLFS for installation instructions), <command>vgrind</command>
  73. converts program sources to Groff input, and <command>grap</command>
  74. is useful for typesetting graphs in Groff documents. The
  75. <command>vgrind</command> and <command>grap</command> programs are
  76. not normally needed for viewing manual pages. They are not part of
  77. LFS or BLFS, but you should be able to install them yourself after
  78. finishing LFS if you wish to do so.</para>
  79. </listitem>
  80. </varlistentry>
  81. </variablelist>
  82. <para>Compile the package:</para>
  83. <screen><userinput remap="make">make</userinput></screen>
  84. <para>This package does not come with a test suite.</para>
  85. <para>Install the package:</para>
  86. <screen><userinput remap="install">make install</userinput></screen>
  87. </sect2>
  88. <sect2>
  89. <title>Non-English Manual Pages in LFS</title>
  90. <!--
  91. <para>Some packages provide UTF-8 manual pages, which previous versions of
  92. <application>Man-DB</application> were unable to display correctly because
  93. the expected (8-bit) encoding for each language was hard-coded in the
  94. source of <application>Man-DB</application>.
  95. <application>Man-DB</application> now uses the extension of the directory
  96. name in order to determine the encoding of the manual pages stored within.
  97. If no extension exists, <application>Man-DB</application> uses a built-in
  98. table (see below) to determine the encoding. E.g., because of "UTF-8" in
  99. the directory name, it knows that all manual pages residing in
  100. <filename class="directory">/usr/share/man/fr.UTF-8</filename> are UTF-8
  101. encoded and, according to the built-in table, expects all manual pages
  102. residing in <filename class="directory">/usr/share/man/ru</filename> to
  103. be encoded using KOI8-R.</para>
  104. <para>Linux distributions have different policies concerning the character
  105. encoding in which manual pages are stored in the filesystem. E.g., RedHat
  106. stores all manual pages in UTF-8, while Debian previously used
  107. language-specific (mostly 8-bit) encodings. Many other distributions simply
  108. ignore the problem all together. LFS also used the legacy encodings in
  109. previuos versions of the book. This was chosen because of the ease of
  110. configuration associated with <application>Man-DB</application>.
  111. Additionally, <application>Man-DB</application> provided support for
  112. Chinese and Japanese locales, and limited support for Korean, whereas
  113. <application>Man</application> did not at that time.</para>
  114. <para>In contrast, the setup in Fedora Core expects all manual pages
  115. to be UTF-8 encoded, and stored in directories without suffixes.
  116. Disagreement about the expected encoding of manual pages amongst
  117. distribution vendors, has led to confusion for upstream package maintainers.
  118. Some packages contain, UTF-8 manual pages, while others ship with manual
  119. pages in legacy encodings. Unlike the
  120. <application>Man</application>/<application>Groff</application> setup in
  121. Fedora Core, <application>Man-DB</application> can make very good decisions
  122. about the on disk encoding and present the information to the user in their
  123. prefered format, without complex configurations.</para>
  124. <para><application>Man-DB</application> has, for the most part, made this
  125. problem completely transparent to end users, as long as the manual pages
  126. are installed into the correct directory. There may be times, however,
  127. where one encoding is preferred over the other. For this purpose, the
  128. <command>convert-mans</command> script was written. It will convert manual
  129. pages to another encoding before (or after) installation. Install the
  130. <command>convert-mans</command> script with the following
  131. instructions:</para>
  132. -->
  133. <para>Some packages provide non-English manual pages. They are displayed
  134. correctly only if their location and encoding matches the expectation of
  135. the "man" program. However, different Linux distributions have different
  136. policies (expressed in the choice of the <command>man</command> program,
  137. its configuration and patches applied to it) concerning the character
  138. encoding in which manual pages are stored in the filesystem.</para>
  139. <para>E.g., Debian previously required Russian manual pages to be encoded
  140. in KOI8-R and to be placed in
  141. <filename class="directory">/usr/share/man/ru</filename>. Now, in addition,
  142. their <command>man</command> program (<application>Man-DB</application>)
  143. searches for UTF-8 encoded Russian manual pages in
  144. <filename class="directory">/usr/share/man/ru.UTF-8</filename>. On the
  145. other hand, Fedora uses UTF-8 encoded manual pages exclusively. Russian
  146. manual pages are found in
  147. <filename class="directory">/usr/share/man/ru</filename> and their
  148. <command>man</command> program doesn't acknowledge
  149. <filename class="directory">/usr/share/man/ru.UTF-8</filename>. Many
  150. other distributions ignore the on disk encodings completely, leaving the
  151. end user with a mix of improperly encoded manual pages for their
  152. configuration. When <command>man</command> processes the requtested page,
  153. it will display the contents as configured, resulting in completely
  154. unreadable text if the on disk encoding is not what is expected for that
  155. configuration.</para>
  156. <para>Disagreement about the expected encoding of manual pages amongst
  157. distribution vendors, has led to confusion for upstream package
  158. maintainers. One package may contain UTF-8 manual pages, while another
  159. ships with manual pages in legacy encodings. <command>man</command>
  160. searches for manual pages based on the user's locale settings.
  161. <application>Man-DB</application> uses a built-in table (see below) to
  162. determine the on disk encoding of manual pages found for a user's
  163. locale, only if the directories found do not have an extension that
  164. describes the encoding. E.g., because of ".UTF-8" in the directory name,
  165. <application>Man-DB</application> knows that all manual pages residing in
  166. <filename class="directory">/usr/share/man/fr.UTF-8</filename> are UTF-8
  167. encoded and, according to the built-in table, expects all manual pages
  168. residing in <filename class="directory">/usr/share/man/ru</filename> to
  169. be encoded using KOI8-R.</para>
  170. <!-- Origin: man-db-2.5.2/src/encodings.c -->
  171. <table>
  172. <title>Expected character encoding of legacy 8-bit manual pages</title>
  173. <?dbfo table-width="2.5in" ?>
  174. <tgroup cols="2">
  175. <colspec colnum="1" colwidth="1.5in"/>
  176. <colspec colnum="2" colwidth="1in"/>
  177. <thead>
  178. <row>
  179. <entry>Language (code)</entry>
  180. <entry>Encoding</entry>
  181. </row>
  182. </thead>
  183. <tbody>
  184. <row>
  185. <entry>Danish (da)</entry>
  186. <entry>ISO-8859-1</entry>
  187. </row>
  188. <row>
  189. <entry>German (de)</entry>
  190. <entry>ISO-8859-1</entry>
  191. </row>
  192. <row>
  193. <entry>English (en)</entry>
  194. <entry>ISO-8859-1</entry>
  195. </row>
  196. <row>
  197. <entry>Spanish (es)</entry>
  198. <entry>ISO-8859-1</entry>
  199. </row>
  200. <row>
  201. <entry>Finnish (fi)</entry>
  202. <entry>ISO-8859-1</entry>
  203. </row>
  204. <row>
  205. <entry>French (fr)</entry>
  206. <entry>ISO-8859-1</entry>
  207. </row>
  208. <row>
  209. <entry>Irish (ga)</entry>
  210. <entry>ISO-8859-1</entry>
  211. </row>
  212. <row>
  213. <entry>Galician (gl)</entry>
  214. <entry>ISO-8859-1</entry>
  215. </row>
  216. <row>
  217. <entry>Indonesian (id)</entry>
  218. <entry>ISO-8859-1</entry>
  219. </row>
  220. <row>
  221. <entry>Icelandic (is)</entry>
  222. <entry>ISO-8859-1</entry>
  223. </row>
  224. <row>
  225. <entry>Italian (it)</entry>
  226. <entry>ISO-8859-1</entry>
  227. </row>
  228. <row>
  229. <entry>Dutch (nl)</entry>
  230. <entry>ISO-8859-1</entry>
  231. </row>
  232. <!-- FIXME: BUG: "no" is deprecated, should use "nb" or "nn" and
  233. symlinks -->
  234. <row>
  235. <entry>Norwegian (no)</entry>
  236. <entry>ISO-8859-1</entry>
  237. </row>
  238. <!-- END BUG -->
  239. <row>
  240. <entry>Portuguese (pt)</entry>
  241. <entry>ISO-8859-1</entry>
  242. </row>
  243. <row>
  244. <entry>Swedish (sv)</entry>
  245. <entry>ISO-8859-1</entry>
  246. </row>
  247. <!-- Languages below require patched groff -->
  248. <row>
  249. <entry>Bulgarian (bg)</entry>
  250. <entry>CP1251</entry>
  251. </row>
  252. <row>
  253. <entry>Czech (cs)</entry>
  254. <entry>ISO-8859-2</entry>
  255. </row>
  256. <row>
  257. <entry>Croatian (hr)</entry>
  258. <entry>ISO-8859-2</entry>
  259. </row>
  260. <row>
  261. <entry>Hungarian (hu)</entry>
  262. <entry>ISO-8859-2</entry>
  263. </row>
  264. <row>
  265. <entry>Japanese (ja)</entry>
  266. <entry>EUC-JP</entry>
  267. </row>
  268. <row>
  269. <entry>Korean (ko)</entry>
  270. <entry>EUC-KR</entry>
  271. </row>
  272. <row>
  273. <entry>Polish (pl)</entry>
  274. <entry>ISO-8859-2</entry>
  275. </row>
  276. <row>
  277. <entry>Russian (ru)</entry>
  278. <entry>KOI8-R</entry>
  279. </row>
  280. <row>
  281. <entry>Slovak (sk)</entry>
  282. <entry>ISO-8859-2</entry>
  283. </row>
  284. <row>
  285. <entry>Serbian (sr)</entry>
  286. <entry>ISO-8859-5</entry>
  287. </row>
  288. <row>
  289. <entry>Turkish (tr)</entry>
  290. <entry>ISO-8859-9</entry>
  291. </row>
  292. <row>
  293. <entry>Simplified Chinese (zh_CN)</entry>
  294. <entry>GBK</entry>
  295. </row>
  296. <row>
  297. <entry>Simplified Chinese, Singapore (zh_SG)</entry>
  298. <entry>GBK</entry>
  299. </row>
  300. <row>
  301. <entry>Traditional Chinese (zh_TW)</entry>
  302. <entry>BIG5</entry>
  303. </row>
  304. <row>
  305. <entry>Traditional Chinese, Hong Kong (zh_HK)</entry>
  306. <entry>BIG5HKSCS</entry>
  307. </row>
  308. </tbody>
  309. </tgroup>
  310. </table>
  311. <note>
  312. <para>Manual pages in languages not in the list are not supported.
  313. Norwegian does not work because of the transition from no_NO to
  314. nb_NO locale, and will be fixed in the next release of
  315. <application>Man-DB</application>. Korean is currently non functional
  316. because of incomplete fixes in the Debian
  317. <application>Groff</application> patch applied in LFS.</para>
  318. </note>
  319. <para>Packages may install manual pages into an improperly named directory,
  320. depending on which distributions the author develops the package for. To
  321. assist in the conversion of the manual pages to the proper encoding for the
  322. directory in which they are installed, the <command>convert-mans</command>
  323. script was written. It will convert manual pages to another encoding before
  324. (or after) installation. Install the <command>convert-mans</command>
  325. script with the following instructions:</para>
  326. <screen><userinput remap="install">cat &gt;&gt; convert-mans &lt;&lt; "EOF"
  327. <literal>#!/bin/sh -e
  328. FROM="$1"
  329. TO="$2"
  330. shift ; shift
  331. while [ $# -gt 0 ]
  332. do
  333. FILE="$1"
  334. shift
  335. iconv -f "$FROM" -t "$TO" "$FILE" >.tmp.iconv
  336. mv .tmp.iconv "$FILE"
  337. done</literal>
  338. EOF
  339. install -m755 convert-mans /usr/bin</userinput></screen>
  340. <para>If upstream distributes the manual pages in a legacy encoding, the
  341. manual pages can simply be copied to
  342. <filename class="directory">/usr/share/man/<replaceable>&lt;language
  343. code&gt;</replaceable></filename>. For example, <ulink
  344. url="http://www.infodrom.org/projects/manpages-de/download/manpages-de-0.5.tar.gz">
  345. German manual pages</ulink> can be installed with the following
  346. commands:</para>
  347. <screen role="nodump"><userinput>mkdir -p /usr/share/man/de
  348. cp -rv man? /usr/share/man/de</userinput></screen>
  349. <para>If upstream distributes manual pages in UTF-8 (i.e., <quote>for
  350. RedHat</quote>) instead of the encoding listed in the table above, they
  351. can either be converted from UTF-8 to the encoding listed in the table
  352. above, or they can be installed directly into
  353. <filename class="directory">/usr/share/man/<replaceable>&lt;language
  354. code&gt;</replaceable>.UTF-8</filename>.</para>
  355. <para>For example, to install <ulink
  356. url="http://manpagesfr.free.fr/download/man-pages-fr-2.40.0.tar.bz2">
  357. French manual pages</ulink> in the legacy encoding, use the following
  358. commands:</para>
  359. <screen role="nodump"><userinput>convert-mans UTF-8 ISO-8859-1 man?/*.?
  360. mkdir -p /usr/share/man/fr
  361. cp -rv man? /usr/share/man/fr</userinput></screen>
  362. <note><para>The French manual pages ship with ready made scripts to do the
  363. same conversion. The above instructions are used only as an example for
  364. use of the <command>convert-mans</command> script.</para></note>
  365. <para>Finally, as an example installation of UTF-8 manual pages, again, the
  366. French manual pages could be installed with the following commands:</para>
  367. <screen role="nodump"><userinput>mkdir -p /usr/share/man/fr.UTF-8
  368. cp -rv man? /usr/share/man/fr.UTF-8</userinput></screen>
  369. </sect2>
  370. <sect2 id="contents-man-db" role="content">
  371. <title>Contents of Man-DB</title>
  372. <segmentedlist>
  373. <segtitle>Installed programs</segtitle>
  374. <seglistitem>
  375. <seg>apropos, catman, convert-mans, lexgrog, man, mandb,
  376. manpath, whatis, and zsoelim</seg>
  377. </seglistitem>
  378. </segmentedlist>
  379. <variablelist>
  380. <bridgehead renderas="sect3">Short Descriptions</bridgehead>
  381. <?dbfo list-presentation="list"?>
  382. <?dbhtml list-presentation="table"?>
  383. <!-- <varlistentry id="accessdb">
  384. <term><command>accessdb</command></term>
  385. <listitem>
  386. <para>Dumps the <command>whatis</command> database contents in
  387. human-readable form</para>
  388. <indexterm zone="ch-system-man-db accessdb">
  389. <primary sortas="b-accessdb">accessdb</primary>
  390. </indexterm>
  391. </listitem>
  392. </varlistentry> -->
  393. <varlistentry id="apropos">
  394. <term><command>apropos</command></term>
  395. <listitem>
  396. <para>Searches the <command>whatis</command> database and displays
  397. the short descriptions of system commands that contain a given
  398. string</para>
  399. <indexterm zone="ch-system-man-db apropos">
  400. <primary sortas="b-apropos">apropos</primary>
  401. </indexterm>
  402. </listitem>
  403. </varlistentry>
  404. <varlistentry id="catman">
  405. <term><command>catman</command></term>
  406. <listitem>
  407. <para>Creates or updates the pre-formatted manual pages</para>
  408. <indexterm zone="ch-system-man-db catman">
  409. <primary sortas="b-catman">catman</primary>
  410. </indexterm>
  411. </listitem>
  412. </varlistentry>
  413. <varlistentry id="convert-mans">
  414. <term><command>convert-mans</command></term>
  415. <listitem>
  416. <para>Reformats manual pages into the chosen encoding.</para>
  417. <indexterm zone="ch-system-man-db convert-mans">
  418. <primary sortas="b-convert-mans">convert-mans</primary>
  419. </indexterm>
  420. </listitem>
  421. </varlistentry>
  422. <varlistentry id="lexgrog">
  423. <term><command>lexgrog</command></term>
  424. <listitem>
  425. <para>Displays one-line summary information about a given manual
  426. page</para>
  427. <indexterm zone="ch-system-man-db lexgrog">
  428. <primary sortas="b-lexgrog">lexgrog</primary>
  429. </indexterm>
  430. </listitem>
  431. </varlistentry>
  432. <varlistentry id="man">
  433. <term><command>man</command></term>
  434. <listitem>
  435. <para>Formats and displays the requested manual page</para>
  436. <indexterm zone="ch-system-man-db man">
  437. <primary sortas="b-man">man</primary>
  438. </indexterm>
  439. </listitem>
  440. </varlistentry>
  441. <varlistentry id="mandb">
  442. <term><command>mandb</command></term>
  443. <listitem>
  444. <para>Creates or updates the <command>whatis</command> database</para>
  445. <indexterm zone="ch-system-man-db mandb">
  446. <primary sortas="b-mandb">mandb</primary>
  447. </indexterm>
  448. </listitem>
  449. </varlistentry>
  450. <varlistentry id="manpath">
  451. <term><command>manpath</command></term>
  452. <listitem>
  453. <para>Displays the contents of $MANPATH or (if $MANPATH is not set)
  454. a suitable search path based on the settings in man.conf and the
  455. user's environment</para>
  456. <indexterm zone="ch-system-man-db manpath">
  457. <primary sortas="b-manpath">manpath</primary>
  458. </indexterm>
  459. </listitem>
  460. </varlistentry>
  461. <varlistentry id="whatis">
  462. <term><command>whatis</command></term>
  463. <listitem>
  464. <para>Searches the <command>whatis</command> database and displays
  465. the short descriptions of system commands that contain the given
  466. keyword as a separate word</para>
  467. <indexterm zone="ch-system-man-db whatis">
  468. <primary sortas="b-whatis">whatis</primary>
  469. </indexterm>
  470. </listitem>
  471. </varlistentry>
  472. <varlistentry id="zsoelim">
  473. <term><command>zsoelim</command></term>
  474. <listitem>
  475. <para>Reads files and replaces lines of the form <emphasis>.so
  476. file</emphasis> by the contents of the mentioned
  477. <emphasis>file</emphasis></para>
  478. <indexterm zone="ch-system-man-db zsoelim">
  479. <primary sortas="b-zsoelim">zsoelim</primary>
  480. </indexterm>
  481. </listitem>
  482. </varlistentry>
  483. </variablelist>
  484. </sect2>
  485. </sect1>