Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2010 19:22:23 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Fbsd1 <fbsd1@a1poweruser.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: How to make "man" pages
Message-ID:  <87wrwswjeo.fsf@kobe.laptop>
In-Reply-To: <4BB2FFB1.4020500@a1poweruser.com> (fbsd1@a1poweruser.com's message of "Wed, 31 Mar 2010 15:54:25 %2B0800")
References:  <4BB2BABF.9070401@a1poweruser.com> <4BB2F8FF.7090707@infracaninophile.co.uk> <4BB2FFB1.4020500@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 31 Mar 2010 15:54:25 +0800, Fbsd1 <fbsd1@a1poweruser.com> wrote:
> OK i want to write a man page from scratch. So lets say i want to use
> /usr/share/man/man2/jail.2.gz as my starting sample. How do I convert
> this .gz file to a plain text file so I can edit it with ee? And how do
> I turn the edited text file back in to a man page .gz file?

The manpage sources are plain text files with text that uses formatting
macros from the groff_mdoc(7) macro collection.  You can find sample
files for the style commonly used by the FreeBSD manpages in your
'/usr/share/examples/mdoc' directory.

    keramida@kobe:/usr/share/examples/mdoc$ ls -ld *[0-9]
    -r--r--r--  1 root  wheel  - 3550 18 =CE=9C=CE=B1=CF=81 01:55 example.1
    -r--r--r--  1 root  wheel  - 7582 18 =CE=9C=CE=B1=CF=81 01:55 example.3
    -r--r--r--  1 root  wheel  - 3302 18 =CE=9C=CE=B1=CF=81 01:55 example.4
    -r--r--r--  1 root  wheel  - 7700 18 =CE=9C=CE=B1=CF=81 01:55 example.9
    keramida@kobe:/usr/share/examples/mdoc$

Installed manpages can be found under '/usr/share/man/man?'.  They are
usually compressed with gzip(1) to save some space, but you can extract
any manpage to a plain text file with gzip or zcat:

    zcat /usr/share/man2/jail.2.gz | more

The source of a manpage commonly uses _many_ formatting macros from the
groff_mdoc(7) collection.  You should probably print a copy of the
'groff_mdoc' manpage and keep it around for reference.  Reading through
this printed copy of the manpage at least once will be useful too, as it
will help you understand how macro options work and you will have a good
idea of what features are available.  Then you will be able to quickly
look in the printed reference copy for the features you need, because
you will know "they are there".




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87wrwswjeo.fsf>