📄 00000060.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: reden (鱼 ~ 君子律己以利人), 信区: Linux <BR>标 题: Creating man pages made easy <BR>发信站: BBS 水木清华站 (Mon Oct 5 00:03:11 1998) WWW-POST <BR> <BR> Creating man pages made easy!!!
<BR>
<BR>Date: Sun, 16 Aug 1998 16:14:34 +1000
<BR>From: Steven K.H. Siew, <A HREF="mailto:ksiew@tig.com.au">ksiew@tig.com.au</A>
<BR>
<BR>Below is something I wrote to help laypeople create their own man pages <BR>easily.
<BR>
<BR>---------------------------------------------------------------------------- <BR>----
<BR>
<BR>If you ever wrote a program using gcc in Linux, you may have come across this <BR>problem. You have just finished your wonderful
<BR>little program which is of great use to you and you need a man page for it.
<BR>
<BR>Of course, you have absolutely no idea how to write a man page. Don't you <BR>need to know how to use troff? Or is it nroff to write
<BR>a man page? Luckily, there is a much easier way to write a man page.
<BR>
<BR>Here I shall describe an easy and quick (and dirty) way of writing a man page <BR>without learning troff or nroff. In order to do so,
<BR>you must have the Perl version 5.004 (or higher) installed on your Linux box. <BR>
<BR>
<BR>There is a man page in the various Perl man pages on the creation of a man <BR>page using the Perl util "pod2man". It is called
<BR>"perlpod.1". Below is a step by step guide to finding the man page and the <BR>util.
<BR>
<BR>
<BR>ksiew> su
<BR>password:
<BR>
<BR>#|/root>locate perlpod.1
<BR>/usr/man/man1/perlpod.1
<BR>
<BR>#|/root>locate pod2man
<BR>/usr/bin/pod2man
<BR>
<BR>Now, to write your own man pages, you must first read the perlpod.1 man page. <BR>You can do this by "man perlpod". However, to
<BR>read the pod2man man page, you must first create it by using pod2man itself. <BR>
<BR>
<BR>
<BR>#|/root>pod2man /usr/bin/pod2man > pod2man.1
<BR>#|/root>ls -al pod2man.1
<BR>-rw-r--r-- 1 root root 13444 Aug 16 12:12 pod2man.1
<BR>#|/root>mv pod2man.1 /usr/man/man1/pod2man.1
<BR>
<BR>Okay, now you can read the pod2man man page you have just created by using <BR>the command "man pod2man". After reading it,
<BR>you can now create your own man pages. As an example, I shall describe a <BR>simple man page for one of my own C programs
<BR>called "addline". I first create a textfile called "addline.pod" and then <BR>turn it into a manpage using 'pod2man --center="Addline
<BR>program manpage" addline.pod > addline.1'.
<BR>
<BR>Finally, I move the addline man page into its proper place using "mv <BR>addline.1 /usr/man/man1/addline.1". There; creating your own
<BR>man page is simple, isn't it?
<BR>
<BR>Below is a sample addline.pod file
<BR>
<BR>
<BR>
<BR>=head1 NAME
<BR>
<BR>addline - addline numbers to textfiles
<BR>
<BR>=head1 SYNOPSIS
<BR>
<BR>B<addline>
<BR>[ B<-c> ]
<BR>[ B<-v> ]
<BR>[ B<-3> ]
<BR>[ B<--colon> ]
<BR>I<inputfile>
<BR>
<BR>=head1 DESCRIPTION
<BR>
<BR>B<addline> inserts line numbers into textfiles. It was written to automate
<BR>the insertion of numbers into a data file of results from a neural network
<BR>program.
<BR>
<BR>=head1 OPTIONS
<BR>
<BR>=over 8
<BR>
<BR>=item -c
<BR>
<BR>Ignores comments lines. A comment line is any line that starts with a '#'.
<BR>This makes it easier to insert comments in the textfile without messing up
<BR>the line numbers.
<BR>
<BR>=item -v
<BR>
<BR>Displays the version number of the addline.
<BR>
<BR>=item -3
<BR>
<BR>Uses 3 digits for the line numbers even if the number requires less than 3
<BR>digits. For example, 013 instead of 13. The default is to use as few
<BR>digits for the line number as possible.
<BR>
<BR>=item --colon
<BR>
<BR>Separates the line number from the rest of the line with a ':' character.
<BR>
<BR>=back
<BR>
<BR>=head1 EXAMPLES
<BR>
<BR> addline textfile
<BR> addline -c textfile
<BR> addline -c --colon textfile
<BR>
<BR>=head1 NOTES
<BR>
<BR>Addline is written in C and compiled using gcc version 2.7.8. It uses the
<BR>standard C library and is designed to be fast and efficient.
<BR>
<BR>=head1 RESTRICTIONS
<BR>
<BR>Never ever use addline on a binary file.
<BR>
<BR>=head1 BUGS
<BR>
<BR>There are no bugs in addline, there are just some undocumented features.
<BR>
<BR>=head1 AUTHORS
<BR>
<BR>Original prototype by Steven Siew, but so massively hacked over by
<BR>his sister such that Steven Siew probably doesn't recognize it anymore.
<BR>
<BR> <BR>-- <BR> 白马带著她一步步的回到中原。白马已经老了,只能慢慢的走, <BR>但终是能回到中原的。江南有杨柳、桃花,有燕子、金鱼…… <BR>汉人中有的是英俊勇武的少年,倜傥潇洒的少年……但这个美 <BR>丽的姑娘就像古高昌国人那样固执: <BR> <BR> 「那都是很好很好的,可是我偏不喜欢。」 <BR> <BR>※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 202.99.18.67] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -