Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

conditional code in e.g. "perlvar.1"

0 views
Skip to first unread message

Alan

unread,
Nov 3, 2008, 5:14:42 PM11/3/08
to
The following examples from "/usr/share/man/man1/perlvar.1" show
conditional code that tests the value of the variable "n". Similar
code can be found in other Perl groff files. I presume that the value
of "n" gets set on the "groff" command line, but I haven't found
discussion of doing that anywhere. Can someone enlighten me?

Example 1:

.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo
10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo
12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}

Example 2:

.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}

Andreas F. Borchert

unread,
Nov 6, 2008, 3:22:05 PM11/6/08
to
On 2008-11-03, Alan <weh...@fnal.gov> wrote:
> The following examples from "/usr/share/man/man1/perlvar.1" show
> conditional code that tests the value of the variable "n". Similar
> code can be found in other Perl groff files. I presume that the value
> of "n" gets set on the "groff" command line, but I haven't found
> discussion of doing that anywhere. Can someone enlighten me?
>
> Example 1:
>
> .ie n \{\

This is a nroff/troff construct which allows to test whether this test is
processed by nroff. Originally, nroff and troff were two different tools
sharing the same input language: nroff generated output suitable for
ASCII screens and simple printers, troff for the C/A/T phototypesetter.
Even in the groff family of tools you'll find a gnroff utility that
emulates the old nroff behaviour.

Practically speaking, ".ie n" allows a test whether we are heading for
an interactively viewed manpage on a simple ASCII screen (typically
through the use of the man utility) or for something else (by generating
PostScript, for example).

Andreas.

0 new messages