Writting Man Page 

just type "man 7 man" and read it.

Here's a template-cum-tutorial:

—tom Tom Christiansen <tchrist@mox.perl.com>

 .TH NAME SECTION
 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
 .\" other parms are allowed: see man(7), man(1)
 .SH NAME
 foo, bar \- programs to do something
 .SH SYNOPSIS
 a short usage summary
 .SH DESCRIPTION
 long drawn out discussion of the program.  it's a good idea
 to break this up into subsections using the .SS macros, like
 these:
 .SS "A Sample Subection"
 .SS "Yet Another Sample Subection"
 .SH OPTIONS
 Some people make this separate from the description.
 .SH "RETURN VALUE"
 What the program or function returns if successful.
 .SH ERRORS
 Return codes, either exit status or errno settings.
 .SH EXAMPLES
 give some example uses of the program
 .SH ENVIRONMENT
 envariables this program might care about
 .SH FILES
 all files used by the program. typical usage is like this:
 .br
 .nf
 .\" set tabstop to longest possible filename, plus a wee bit
 .ta \w'/usr/lib/perl/getopts.pl   'u
 \fI/usr/man\fR default man tree
 \fI/usr/man/man*/*.*\fR unformatted (nroff source) man pages
 .SH "SEE ALSO"
 .\" Always quote multiple words for .SH
 other man pages to check out, like man(1), man(7), makewhatis(8), catman(8)
 .SH NOTES
 miscellaneous commentary
 .SH CAVEATS
 things to take special care with.  sometimes called WARNINGS.
 .SH DIAGNOSTICS
 all the possible error messages the program can print out, and
 what they mean.
 .SH BUGS
 things that are broken or just don't work quite right.
 .SH RESTRICTIONS
 bugs you don't plan to fix :-)
 .SH AUTHOR
 who wrote it (or AUTHORS if multiple)
 .SH HISTORY
 programs derived from other sources sometimes have this.

documented on: Tue 06-01-99 17:49:30