我有一个troff格式的文件,想重新制作成man page。
文件.txt。
.. c:function:: bool is_module_percpu_address (unsigned long addr)
test whether address is from module static percpu
**Parameters**
``unsigned long addr``
address to test
**Description**
Test whether **addr** belongs to module static percpu area.
**Return**
``true`` if **addr** is from module static percpu area
.. c:function:: int module_refcount (struct module * mod)
return the refcount or -1 if unloading
**Parameters**
``struct module * mod``
the module we're checking
**Return**
-1 if the module is in the process of unloading
otherwise the number of references in the kernel to the module
我不太明白groff的输出,当我做的时候 groff file.txt | man -l -
.
如你所见,我从来没有做过man page,只是想用troff格式,把它做成一个可读的man page。
如何做到这一点?
PS:输出来自perl脚本 kernel-doc
从提供的源代码树中。我知道它是否是troff格式,但脚本说是这样的(Output troff manual page format
)
我偶然发现了一个叫做 rst2man
在python中编写的,它的转换工作。它是不完美的,但更好的选择,然后 pandoc
. 如果有人试图例如阅读内核文档. 你可以用
kernel-doc path/to/kernel/source.{c,h} | rst2man -q - | man -l -
kernel-doc
是源码树中的Perl脚本
rst2man
是python脚本