Man
建議下載下面四個man手冊 | //命令:sudo apt-get install manpages |
roger@ubuntu:~$ dpkg -l | grep manpages
ii manpages 3.24-1ubuntu1 Manual pages about using a GNU/Linux system
ii manpages-dev 3.24-1ubuntu1 Manual pages about using GNU/Linux for development
ii manpages-posix 2.16-1 Manual pages about using POSIX system
ii manpages-posix-dev 2.16-1 Manual pages about using a POSIX system for development
? ?
************************************************************
?man 中文
通過linux wget下載開發包
[chengmo@centos5 ~]$ wget?http://manpages-zh.googlecode.com/files/manpages-zh-1.5.tar.gz
輸入即可
? ?
2、解壓man中文手冊包
只要在自己工作目錄下面建立man/zh_CN 目錄,將壓縮包解壓,按照規格目錄中。man命令就可以搜索到。
特別說明下,下面的安裝保證你的語言環境設置為中文:
[chengmo@centos5 ~]$ echo $LANG
zh_CN.GB2312?
如果不是:通過 export LANG=zh_CN.GB2312?
如果你發現上面執行不通過,你可以運行:locale -a 查一下你系統支持的字符集
? ?
[chengmo@centos5 ~]$ cd ~?
#進入當前目錄?
[chengmo@centos5 ~]$ mkdir -p man/zh_CN
#建立目錄man 以及子目錄zh_CN?
[chengmo@centos5 ~]$ tree man?
man
`-- zh_CN?
#目錄以及子目錄已經可以了,現在只需要將壓縮包解壓到zh_CN 中文目錄即可?
[chengmo@centos5 ~]$ tar -xzvf manpages-zh-1.5.tar.gz?
manpages-zh-1.5/src/mann/expr.n?
manpages-zh-1.5/src/mann/fblocked.n?
manpages-zh-1.5/src/mann/fconfigure.n?
manpages-zh-1.5/src/mann/fcopy.n?
manpages-zh-1.5/src/mann/file.n?
manpages-zh-1.5/src/mann/fileevent.n?
manpages-zh-1.5/src/mann/filename.n?
manpages-zh-1.5/src/mann/flush.n?
manpages-zh-1.5/src/mann/focusNext.n?
manpages-zh-1.5/src/mann/for.n?
manpages-zh-1.5/src/mann/foreach.n?
#......解壓數據包?
[chengmo@centos5 ~]$ cd manpages-zh-1.5?
[chengmo@centos5 manpages-zh-1.5]$ ls
COPYING debian DOCS Makefile man-pages-zh_CN.spec raw README README.GB src utils?
#該目錄結構 支持make安裝的,可以通過make命令生成編譯文件,也可以直接復制里面src目錄安裝?
[chengmo@centos5 manpages-zh-1.5]$ make
mkdir UTF-8?
cp -r src/man* UTF-8/?
#已經生成了:UTF-8目錄下面文件,只需要將該目錄復制到~/man/zh_CN下面即可?
[chengmo@centos5 manpages-zh-1.5]$ cp -r UTF-8/* ~/man/zh_CN/
? ?
通過上面幾步已經將幫助手冊安裝到自己的工作目錄下面的man/zh_CN下面了。
3、測試man中文幫助手冊是否安裝成功
? ?
1 下面檢查下,看man中文手冊是否加入到man路徑里面了。
? ?
[chengmo@centos5 manpages-zh-1.5]$ man -w?
/usr/kerberos/man:/usr/local/share/man:/usr/share/man/zh_CN:/usr/share/man:/home/chengmo/man/zh_CN:/home/chengmo/man:/usr/local/ma
? ?
n
#發現已經在MANPATH路徑加入了:/home/chengmo/man 以及:/home/chengmo/man/zh_CN?
[chengmo@centos5 ~]$ man -aw passwd
/usr/share/man/man1/passwd.1.gz?
/usr/share/man/man5/passwd.5.gz?
/home/chengmo/man/zh_CN/man5/passwd.5?
#發現已經找到中文手冊了?
[chengmo@centos5 ~]$ man 5 -aw passwd
/usr/share/man/man5/passwd.5.gz?
/home/chengmo/man/zh_CN/man5/passwd.5?
#讀取領域5限定類型,這樣系統原先的英文也保留了,看中英文也很方便?
[chengmo@centos5 ~]$ man 5 -a passwd?
#顯示英文的,按q就會出來中文文檔了
? ?
源文檔 <http://bbs.hx95.com/read-htm-tid-193816-fpage-2.html>
************************************************************
? ?
************************************************************
關于man頁的寫作和,寫好后,怎么看效果,怎么把它加入到manpath.
? ?
1.man頁的書寫
本書是利用docbook進行書寫man頁的。下面是一個利子,你可以參考一下
<?xml version='1.0' encoding='utf-8'?>
? ?
<refentry xml:id="myprintf" xmlns="http://docbook.org/ns/docbook"
??? version="5.0">
??? <info>
??? ??? <productname>
??? ??? </productname>
??? ??? <author>
??? ??? ??? <firstname>
??? ??? ??? ??? xinglong
??? ??? ??? </firstname>
? ?
??? ??? ??? <surname>
??? ??? ??? ??? wang
??? ??? ??? </surname>
? ?
??? ??? ??? <contrib>
??? ??? ??? ??? ??? banshi
??? ??? ??? ??? ??? xxp
??? ??? ??? ??? ??? mew
??? ??? ??? </contrib>
? ?
??? ??? ??? <contrib>
??? ??? ??? ??? xxp
??? ??? ??? </contrib>
? ?
??? ??? ??? <contrib>
??? ??? ??? ??? xiaolong
??? ??? ??? </contrib>
??? ??? </author>
??? </info>
??? <refmeta>
??? ??? <manvolnum>
??? ??? ??? 3
??? ??? </manvolnum>
? ?
??? ??? <refmiscinfo class="sectdesc">
??? ??? ??? Linux Programmer's Manual
??? ??? </refmiscinfo>
? ?
??? ??? <refmiscinfo class="software">
??? ??? ??? myprintf xxp
??? ??? </refmiscinfo>
? ?
??? ??? <refmiscinfo class="version">
??? ??? ??? 1.2
??? ??? </refmiscinfo>
??? </refmeta>
? ?
??? <refnamediv>
??? ??? <refname>myprintf</refname>
??? ??? <refname>xxmyprintf</refname>
??? ??? <refname>ssprintf</refname>
? ?
??? ??? <refpurpose>print formatted output</refpurpose>
??? </refnamediv>
? ?
??? <refsynopsisdiv>
??? ??? <funcsynopsis>
??? ??? ??? <funcsynopsisinfo>
??? ??? ??? ??? #include <stdio.h>
??? ??? ??? </funcsynopsisinfo>
? ?
??? ??? ??? <funcprototype>
??? ??? ??? ??? <funcdef>
??? ??? ??? ??? ??? int?
??? ??? ??? ??? ??? <function>
??? ??? ??? ??? ??? ??? myprintf
??? ??? ??? ??? ??? </function>
??? ??? ??? ??? </funcdef>
? ?
??? ??? ??? ??? <paramdef>
??? ??? ??? ??? ??? const char *
??? ??? ??? ??? ??? <parameter>
??? ??? ??? ??? ??? ??? format
??? ??? ??? ??? ??? </parameter>
??? ??? ??? ??? </paramdef>
? ?
??? ??? ??? ??? <varargs/>
??? ??? ??? </funcprototype>
? ?
??? ??? ??? <funcprototype>
??? ??? ??? ??? <funcdef>
??? ??? ??? ??? ??? int?
??? ??? ??? ??? ??? <function>
??? ??? ??? ??? ??? ??? xxprintf
??? ??? ??? ??? ??? </function>
??? ??? ??? ??? </funcdef>
? ?
??? ??? ??? ??? <paramdef>
??? ??? ??? ??? ??? const char *
??? ??? ??? ??? ??? <parameter>
??? ??? ??? ??? ??? ??? format
??? ??? ??? ??? ??? </parameter>
??? ??? ??? ??? </paramdef>
? ?
??? ??? ??? ??? <varargs />
??? ??? ??? </funcprototype>
? ?
??? ??? ??? <funcprototype>
??? ??? ??? ??? <funcdef>
??? ??? ??? ??? ??? int?
??? ??? ??? ??? ??? <function>
??? ??? ??? ??? ??? ??? ssprintf
??? ??? ??? ??? ??? </function>
??? ??? ??? ??? </funcdef>
? ?
??? ??? ??? ??? <paramdef>
??? ??? ??? ??? ??? char *
??? ??? ??? ??? ??? <parameter>
??? ??? ??? ??? ??? ??? s
??? ??? ??? ??? ??? </parameter>
??? ??? ??? ??? </paramdef>
? ?
??? ??? ??? ??? <paramdef>
??? ??? ??? ??? ??? const char *
??? ??? ??? ??? ??? <parameter>
??? ??? ??? ??? ??? ??? format
??? ??? ??? ??? ??? </parameter>
??? ??? ??? ??? </paramdef>
? ?
??? ??? ??? ??? <varargs/>
??? ??? ??? </funcprototype>
??? ??? </funcsynopsis>
? ?
??? </refsynopsisdiv>
? ?
??? <refsect1>
??? ??? <title>
??? ??? ??? Description
??? ??? </title>
? ?
??? ??? <para>
??? ??? ??? <indexterm>
??? ??? ??? ??? <primary>
??? ??? ??? ??? ??? functions
??? ??? ??? ??? </primary>
? ?
??? ??? ??? ??? <secondary>
??? ??? ??? ??? ??? myprintf
??? ??? ??? ??? </secondary>
??? ??? ??? </indexterm>
? ?
??? ??? ??? <indexterm>
??? ??? ??? ??? <primary>
??? ??? ??? ??? ??? printing function
??? ??? ??? ??? </primary>
??? ??? ??? </indexterm>
? ?
??? ??? ??? <function>
??? ??? ??? ??? myprintf
??? ??? ??? </function>
??? ??? ??? ?places output on the standard
??? ??? ??? ? output stream stdout.
??? ??? </para>
??? </refsect1>
? ?
</refentry>
? ?
? ?
將上面的內容保存在mymanpages.xml
2.man頁的生成
xsltproc manpages/docbook.xsl? mymanpages.xml
? ?
這時,就生成了
myprintf.3 ssprintf.3? xxmyprintf.3
三個文件
3.看man頁的效果
man ./myprintf.3
如果效果不好。。你想加入一些更多的內容,
這時,你可以修改mymanpages.xml的內容
? ?
4.對man頁打包
gzip myprintf.3
? ?
你也可以把所生成的man頁文件都打包了,這里為了測試,就只打這么 一個
? ?
然后建立的你man頁首目錄
我以,我的當前目錄為man首目錄
比如,現在,我在我的目錄下建立文件夾
mew@mew:~/practice/xml$ pwd
/home/mew/practice/xml
mew@mew:~/practice/xml$ mkdir man3
mew@mew:~/practice/xml$ gzip myprintf.3
mew@mew:~/practice/xml$ cp myprintf.3.gz ./man3/
4.修改manpath
cd /etc/
sudo vim manpath.config
? ?
找到
#---------------------------------------------------------
# every automatically generated MANPATH includes these fields
#
#MANDATORY_MANPATH ??? ??? ??? /usr/src/pvm3/man
#
MANDATORY_MANPATH??? ??? ??? /usr/man
MANDATORY_MANPATH??? ??? ??? /usr/share/man
MANDATORY_MANPATH??? ??? ??? /usr/local/share/man
? ?
? ?
然后在這一段中加入你存放你自己寫的man頁目錄
如我加入了下面一行
MANDATORY_MANPATH??? ??? ??? /home/mew/practice/xml
5.現在,你就可以用man? myprintf了
? ?
源文檔 <http://blog.csdn.net/wang72560/article/details/6280315>
************************************************************
? ?
轉載于:https://www.cnblogs.com/mylinux/archive/2013/05/01/3052763.html
總結
- 上一篇: 中国海军医科大学需要必须是团员才能进吗?
- 下一篇: Windows线程