天天看点

如何往linux 系统中添加帮助文档

第三方提供的库函数或者自己提供给别人的接口里,为了便于使用通常会提供帮助文档。那么该如何把把这些文档添加到linux 操作系统当中去,使得可以通过man 查看呢?下面以libaio的帮助文档为例,进进行实例说明。

在添加帮助文档到系统之前,可以看到man无法找到libaio相关函数的帮助文档:

[root@localhost man]# man io_prep_pwrite

No manual entry for io_fsync

 为此,可以参考下面的命令进行添加:

step 1. 下载得到原始帮助文档:

git clone https://github.com/crossbuild/libaio

cd libaio/man

ls

-rw-r--r--. 1 root root 2570 Sep 13 00:17 io_getevents.3

-rw-r--r--. 1 root root 2385 Sep 13 00:17 io_fsync.3

-rw-r--r--. 1 root root 1691 Sep 13 00:17 io_cancel.3

-rw-r--r--. 1 root root 1391 Sep 13 00:17 io_queue_wait.3

-rw-r--r--. 1 root root 1020 Sep 13 00:17 io_queue_run.3

-rw-r--r--. 1 root root 1039 Sep 13 00:17 io_queue_release.3

-rw-r--r--. 1 root root 1300 Sep 13 00:17 io_queue_init.3

-rw-r--r--. 1 root root 1647 Sep 13 00:17 io_prep_pwrite.3

-rw-r--r--. 1 root root 1701 Sep 13 00:17 io_prep_pread.3

-rw-r--r--. 1 root root 2473 Sep 13 00:17 io_prep_fsync.3

-rw-r--r--. 1 root root  991 Sep 13 00:17 io_set_callback.3

-rw-r--r--. 1 root root 3667 Sep 13 00:17 io_submit.3

-rw-r--r--. 1 root root 8881 Sep 13 00:21 io.3

step 2: 转化成.gz格式:

[root@localhost man]# for i in `ls `; do tar czf $i.gz $i; done

step 3: 拷贝到正确的地方

[root@localhost man]# pwd

/home/qxia/workspace/crosslibaio/libaio/man

[root@localhost man]# cp *.3 /usr/share/man/man3/

step 4: 再次测试:

如何往linux 系统中添加帮助文档

继续阅读