Date: Fri, 20 Mar 1998 12:44:17 +0000 From: nik@iii.co.uk To: MALCOLM BOFF <Malcolm_Boff@compuserve.com> Cc: freebsd-questions <freebsd-questions@FreeBSD.ORG> Subject: Re: man pages Message-ID: <19980320124417.57814@iii.co.uk> In-Reply-To: <199803200714_MC2-3768-EB0F@compuserve.com>; from MALCOLM BOFF on Fri, Mar 20, 1998 at 07:13:48AM -0500 References: <199803200714_MC2-3768-EB0F@compuserve.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 20, 1998 at 07:13:48AM -0500, MALCOLM BOFF wrote:
> (This note refers to 2.2.2-RELEASE)
> I have been trying to understand how man works in order that I can get some
> properly formatted printouts and come up with the following conclusions.
>
> assuming the command 'man man' is executed then
> the following command is executed :-
> zcat /usr/share/man/cat1/man.1.gz
> this file after decompression is not in *roff format
That's right. The process of formatting a man page can be time consuming,
so to save time (at the expense of disk space) formatted copies of them
are kept in the /usr/(local/)share/man/cat* directories. These copies are
formatted for the screen only, not for any other device.
However, the first time you look at a manual page a formatted copy
probably won't exist.
In this case, when you type "man command" you'll see the message
Formatting page, please wait...
and the page will appear after a short while. A formatted copy of the page
will be put in the appropriate /usr/(local/)share/man/cat* directory. So
the next time you look at the man page the formatted version will come
up immediately.
Try it. Pick a command you've never run, perhaps 'ypwhich' or something
similarly esoteric, and look at it's man page twice. The second time it
will come up much faster than the first.
In your example above, 'man' has checked to see if a pre-formatted copy
exists. It does, so 'man' displays it straight away.
> assuming that the command 'man -t man' is executed then
> the following command is executed
> zcat /usr/share/man/man1/man.1.gz | tbl | troff
> the compressed file is in *roff format
Yep. In this case you need to work on the original *roff format file, so
that's used instead.
> This operation by default will use the troff device 'devps' ie postscript
> this does not seem to be the case however so I tried executing the command
> manually as :-
>
> zcat /usr/share/man/man1/man.1.gz | tbl | troff -Tascii
>
> and expected an ascii printable but that didn't give me what I expected.
No.
[I'm on shakier ground here, someone feel free to correct me].
Use troff when you want output formatted for a printing device, use nroff
when you want output formatted for the screen (both of these commands are
emulated by groff anyway).
So your command line above should be
zcat /usr/share/man/man1/man.1.gz | tbl | nroff
However, that will just give you the text without any of of the formatting.
In order to get the formatting, you need to tell nroff to use the right
macro package for the file type you're displaying. The command switch to
do this is "-mmacro_package", (i.e., "-m" and then the name of the macro
package with no space).
For reasons that will shortly be apparent, the macro package that defines
how manual pages are processed is called 'an'. This then allows you
to write
zcat /usr/share/man/man1/man.1.gz | tbl | nroff -man
and have things work as you expect.
One more thing. Some folks have enough diskspace to burn that they can
afford to keep preformatted copies of all the manual pages around, so
there's never any wait for 'man' to format them.
If you want to do this, investigate the 'catman' program and its commented
out entry in /etc/weekly.
Hope that's helpful.
N
--
Work: nik@iii.co.uk | FreeBSD + Perl + Apache
Rest: nik@nothing-going-on.demon.co.uk | Remind me again why we need
Play: nik@freebsd.org | Microsoft?
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980320124417.57814>
