Date: Sat, 21 Mar 1998 09:58:18 +1030 From: Greg Lehey <grog@lemis.com> To: MALCOLM BOFF <Malcolm_Boff@compuserve.com>, freebsd-questions <freebsd-questions@FreeBSD.ORG> Subject: Re: man pages Message-ID: <19980321095818.28357@freebie.lemis.com> 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, 20 March 1998 at 7:13:48 -0500, MALCOLM BOFF wrote: > (This note refers to 2.2.2-RELEASE) You'll be happy to know that in fact, the principles refer to all versions of UNIX. > 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 Correct. The *roff sources are in /usr/share/man/man*, and man puts formatted versions in /usr/share/man/cat* if these directories exist. >From then on, it only formats if the file in man* is newer than the corresponding file in cat*. > 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 Correct. /usr/share/man/man1/man.1.gz is the source file. It doesn't change. > This operation by default will use the troff device 'devps' ie postscript > this does not seem to be the case however Well, in fact it generates intermediate code for one of the groff postprocessors. You'll note that the output starts with x T ps x res 72000 1 1 x init > 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. In this case, it generates intermediate code for another of the groff postprocessors. Now the output starts with x T ascii x res 240 24 40 x init > Is the command troff working correctly ? Yes. > Should it be proceeded by 'groff'? No. > There seems to be something not quite right here or is my > understanding incorrect ? Mainly, it's confusing documentation :-) Historically, troff doesn't produce final output, so GNU troff doesn't either. For that, use groff instead of troff. In addition, you need to specify a macro package for just about any *roff source. In the case of man pages, it's either the 'an' package (traditional man pages) or the 'doc' package (GNU and similar). There's a third package, 'andoc', which decides which package to load, so you can format any man page with zcat <page> | groff -mandoc -t -p The -t and -p options run tbl and pic respectively. This will give you PostScript output. If you want ASCII output, you could write this instead: zcat <page> | nroff -mandoc -t -p Of course, in this case it's easier to write: man <page> Greg 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?19980321095818.28357>