Files
plan9port/tmac/tmac.an
G. Branden Robinson 46fbe4cd00 tmac/tmac.an*: work around formatter bug
...when rendering some man pages, such as those of ncurses.

I did not manage (nor seriously attempt) to identify the root cause of
this bug.  ncurses's use of `SH` and `SS` man(7) macros is
unremarkable.[1]  I cannot account for why the less(1) man page renders
fine and ncurses pages like insstr(3) do not.  But render badly they do,
emitting *roff logic as formatted output.

```
$ 9 nroff -man $(man -w insstr) | grep -F .ss | cat -v
     "'''if^GNAME^GSYNOPSIS^G .ss 18 NAME
     "'''if^GSYNOPSIS^GSYNOPSIS^G .ss 18 SYNOPSIS
     "'''if^GDESCRIPTION^GSYNOPSIS^G .ss 18 DESCRIPTION
     "'''if^GRETURN^GSYNOPSIS^G .ss 18 RETURN VALUE
     "'''if^GNOTES^GSYNOPSIS^G .ss 18 NOTES
     "'''if^GEXTENSIONS^GSYNOPSIS^G .ss 18 EXTENSIONS
     "'''if^GPORTABILITY^GSYNOPSIS^G .ss 18 PORTABILITY
     "'''if^GHISTORY^GSYNOPSIS^G .ss 18 HISTORY
     "'''if^GSEE^GSYNOPSIS^G .ss 18 SEE ALSO
```

With this patch:

```
$ 9 nroff -man $(man -w insstr) | grep -F .ss | cat -v | grep . || echo NO OUTPUT
NO OUTPUT
```

I do observe that the problem seems to correspond to the only use in the
package of the old-fashioned `'''` commenting convention _within a macro
definition_.  I have a notion of how GNU troff works, but little about
AT&T troff.  That said, if I were to try to get to the bottom of this
problem, I'd look into if and how the no-break command character is
handled differently in copy mode.  I see nothing in CSTR #54 to suggest
that the command characters have different meanings in copy mode and its
complement.[2]

My solution is to use idiomatic comment syntax inside macro definitions.

[1] d5dc8a4a7c/man/curs_insstr.3x (L47)

[2] unnamed in AT&T documentation but which I term "interpretation mode"
    in groff
2025-10-26 19:03:55 -04:00

549 lines
8.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.fp 1 R LuxiSans
.fp 2 I LuxiSans-Oblique
.fp 3 B LuxiSans-Bold
.fp 4 BI LuxiSans-BoldOblique
.fp 5 L LuxiMono
.ds 9 /usr/local/plan9
.if n .uf 4
.if n .bd 3
.if n .rm bd
'''\" PWB Manual Entry Macros - 1.36 of 11/11/80
'''\" Nroff/Troff Version @(#)1.36
'''\" Option -rs1 short (9") pages
'''\" Option -rp# set no. of first page, put no. of pgs. on stderr
'''\" Option -rd1 give modified date instead of printed date
... temporary fixes for neat manual printing...
.de th
.tm wrong version of man entry macros - use -man6
.ab 
..
.if n .ds Tm \uTM\d
.if t .ds Tm \v'-0.5m'\s-4TM\s+4\v'0.5m'
.de }E
.}f
.in \\n()Ru+\\n(INu
.ll \\n(LLu
.lt \\n(LLu
.pl \\n()Lu
..
.de DT
.if t .ta 3.6m 7.2m 10.8m 14.4m 18m 21.6m 25.2m 28.8m 32.4m 36m 39.6m 43.2m 46.8m
.if n .ta 5n 10n 15n 20n 25n 30n 35n 40n 45n 50n 55n 60n 65n
..
.de HY
.hy 14
..
.de }f
.if t .vs \\n()Vp
.ps \\n()S
.ft 1
..
.de }H
.ev 1
.}C
.}E
.ie \\n()s 'sp |2v
.el 'sp |3v
.". ps\\n()S-1
.tl \\*(]H\\*(]L\\*(]H
.ft 1
.ps \\n()S
.ie \\n()s 'sp 1.5v
.el 'sp 3v
.ev
.ns
.if \\n(CL .2C
..
.de }F
.ev 1
.}E
.if \\n()s 'sp |\\n(.pu-1v-1p
.if \\n()t 'sp |\\n(.pu-3v
.if n 'sp |\\n(.pu-4v
.if n .tl Page %\\*(]D\\*(]W
.if t .tl %
.ev
'bp
..
.if n .ig
.de }C
.if "\\*(.T"aps"\{\
. p o0i
. l t7.5i
. i f\\n()s .tl \l0.25i\l0.25i\h1i\l0.25i
. i f\\n()t .tl \l0.25i\l0.25i
. l t
. p o\}
..
.de }M
.}N
.wh -.5p }C
.ll \\n(LLu
.}P
..
.de }K
.}N
.pl 1
.ll \\n(LLu
..
.de }P
.nr )P \\n%+1-\\np
.if \\nq .tm \\n(.F \\n()P \\np
.bp
.if \\nq .nr p \\n%
..
.de TH
.PD
.nr IN \\n()Mu
.if t .ds ]H \\$1\^(\^\\$2\^)
.if n .ds ]H \\$1(\\$2)
.if \\n()s .ds ]D
.if \\n()t .ds ]D Plan 9
.if n .ds ]D Plan 9
.ds ]L
.if !\\$3 .ds ]L (\^\\$3\^)
.if !\\$4 .ds ]D \\$4
.wh 0 }H
.wh -\\n(:mu }F
.em }M
.if \\n(nl .}P
.nr )I \\n()Mu
.nr )R 0
.}E
.DT
.if n \{.na
.nh \}
.if t \{.bd S 3 3
.HY \}
\Xhtml <B>
\Xhtml [<A HREF="/sys/man/index.html">manual index</A>]
\Xhtml [<A HREF="/sys/man/\\$2/INDEX.html">section index</A>]
\Xhtml </B>
..
.de HR
.ie '\\$2'' \\$4\X'html href \\$1'\fL\\$1\fP\X'html /href'\\$3
.el \\$4\X'html href \\$1'\\$2\X'html /href'\\$3
..
.de SH
.PD
.}X 0 "\\$1"
.nr )E 2
\&\Xhtml <H4>\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6\Xhtml </H4>
..
.de SS
.PD
.}X 3n "" ""
.nr )E 2
\Xhtml <H4>\&\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6\Xhtml </H4>
..
.de }X
.}E
.ti \\$1
.sp \\n(PDu
.ne 1.1v
.nr )R 0
.fi
.\"ss12
.\"if\\$2SYNOPSIS .ss 18
.it 1 }N
.if !\\$3 .SM
.ft 3
..
.de }2
.nr )E 0
.}E
.nr )I \\n()Mu
.ns
.ft 1
..
.de SM
.nh
.ps \\n()S-1
.if !\\$1 \&\\$1
.if !\\$2 \&\\$2
.if !\\$3 \&\\$3
.if !\\$4 \&\\$4
.if !\\$5 \&\\$5
.if !\\$6 \&\\$6
.if !\\$1 .ps \\n()S
.if \\$1 .it 1 }N
.HY
..
.de I
.nh
.ft 2
.it 1 }N
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
.HY
..
.de B
.nh
.it 1 }N
.ie !\\$1 \%\&\f5\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
.el .ft5
.HY
..
.de L
.nh
.it 1 }N
.if t \{.ie!\\$1 \%\&\f5\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
.el .ft5 \}
.if n \{.ft5
.if !\\$1 \{.ie\\$2 `\\$1'
.el .ie\\$3 `\\$1 \\$2'
.el .ie\\$4 `\\$1 \\$2 \\$3'
.el .ie\\$5 `\\$1 \\$2 \\$3 \\$4'
.el .ie\\$6 `\\$1 \\$2 \\$3 \\$4 \\$5'
.el `\\$1 \\$2 \\$3 \\$4 \\$5 \\$6'\}\}
.HY
..
.de RI
.nh
.}S 1 2 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.de IR
.nh
.}S 2 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.\" MR - manual reference, as in .MR cat 1 ,
.\" $3 is the punctuation after the reference ends, if any.
.de MR
.nh
.}S 2 1 \& "\Xhtml manref start \\$1 (\\$2)\\$1" "(\\$2)\Xhtml manref end \\$1 (\\$2)\\$3"
.HY
.}f
..
.de IB
.nh
.if t .}S 2 5 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.if n .}S 2 1 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.de RB
.nh
.if t .}S 1 5 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.if n .}S 1 1 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.de BR
.nh
.if t .}S 5 1 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.if n .}S 1 1 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.de BI
.nh
.if t .}S 5 2 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.if n .}S 1 2 \%\& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
.HY
.}f
..
.de LR
.nh
.if t \%\&\f5\\$1\f1\\$2
.if n \%`\\$1'\\$2
.HY
..
.de RL
.nh
.if t \%\&\f1\\$1\\f5\\$2\\f1\\$3
.if n \%\\$1`\\$2'\\$3
.HY
..
.de }S
.ds ]F
.if \\$12 .if !\\$5 .ds ]F \^
.if \\$22 .if !\\$5 .ds ]F \^
.ie !\\$4 .}S \\$2 \\$1 "\\$3\f\\$1\\$4\\*(]F" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
.el \\$3
.}f
..
.de EX
.if t .ft5
.nf
..
.de EE
.ft 1
.fi
..
.de }p
.sp \\n(PDu
.ne 1.1v
.}E
.nr )I \\n()Mu
.ns
..
.de PP \"indirect PP so we can attach html - see tmac.anhtml
.}p
..
.de P
.PP
..
.de LP
.PP
..
.de PD
.if t .nr PD .4v
.if n .nr PD 1v
.if !\\$1 .nr PD \\$1v
..
.de HP
.sp \\n(PDu
.ne 1.1v
.if !\\$1 .nr )I \\$1n
.ll \\n(LLu
.in \\n()Ru+\\n(INu+\\n()Iu
.ti \\n()Ru+\\n(INu
.}f
..
.de IP
.ie !\\$1 \{.TP "\\$2"
\&\\$1\}
.el \{.sp\\n(PDu
.ne 1.1v
.if !\\$2 .nr )I \\$2n
.}f
.ll \\n(LLu
.in \\n()Ru+\\n(INu+\\n()Iu
.lg \}
..
.de TP
.if !\\$1 \{.nr )I \\$1n
.if \\$10 .nr )I \\n()M\}
.sp \\n(PDu
.ne 1.1v
.in \\n()Ru
.lg 0
.ns
.it 1 }N
.nr )E 1
.di ]B
..
.de TF
.IP "" "\w'\f5\\$1\ \ \fP'u"
.PD 0
..
.de }1
.ds ]X \&\\*(]B\\
.rm ]B
.nr )E 0
.if !\\$1 .nr )I \\$1n
.}f
.ll \\n(LLu
.in \\n()Ru+\\n(INu+\\n()Iu
.ti \\n(INu
.ie !\\n()Iu+\\n()Ru-\w\\*(]Xu-3p \{\\*(]X
.br \}
.el \\*(]X\h|\\n()Iu+\\n()Ru\c
.}f
.lg
..
.de }N
.if \\n()E .br
.if \\n()E1 .di
.if \\n()E0 .}f
.if \\n()E1 .}1
.if \\n()E2 .}2
..
.de RS
.nr ]\\n+()p \\n()I
.nr )\\n()p \\n()R
.ie !\\$1 .nr )R +\\$1n
.el .nr )R +\\n()I
.nr )I \\n()Mu
.}E
..
.de RE
.if !\\$1 \{.ie \\$10 .nr )p 1 1
.el .nr )p \\$1 1 \}
.ds ]i \\*(]I\\n()p
.ds ]r \\*(]R\\n()p
.nr )I \\*(]i
.nr )R \\*(]r
.if \\n()p .nr )p -1
.}E
..
'''\" .2C begin 2-column display, by diversion
'''\" CC=amount of text that will fit on page
'''\" CL=1 multicolumn in effect, else 0
'''\" CI saved indent
'''\" CB contains diverted text
.de 2C
.ne 2
.nf
.nr CC \\n(.t/1v*2v
.nr CI \\n(IN
.nr IN 0
.di CB
.nr CL 1
.}E
.dt \\n(CCu C1
..
'''\" .1C return to 1-column
.de 1C
.nr CL 0
.C1
.fi
..
'''\" end of diversion, at end of page or return to 1-column
'''\" CC=pos of nominal column end
.de C1
.dt
\!.C3
.di
.if \\n(dn \{.nr CC \\n(dnu/2u+\\n(nlu
.wh \\n(CCu C2
.mk
.nf
.nr IN \\n(CIu
.}E
.CB \}
..
'''\" end of first column retrieved from diversion
'''\" CC=pos of actual column end
.de C2
.wh \\n(CCu
.mk CC
.po +(\\n(LLu/2u)u
.rt
.if \\n(dn>1v .ns
..
'''\" end of second column
.de C3
.br
.po -(\\n(LLu/2u)u
.if \\n(CC>\\n(nl .sp |\\n(CCu
.ne 2
..
.de PM
.if \\$1 .nr !K 0
.if \w\\$1 \{\
.ie \\$1P .nr !K 1
.el .ie \\$1BP .nr !K 3
.el .ie \\$1BR .nr !K 4
.el .nr !K 2 \}
.if \\n(!K .wh -(\\n(:mu+5v) )G
..
.de )G
.if \\n(!K 'sp 2v
.ie \\n(!K=1 \{\
.ie t .bd1 3
.el .bd1 0
.tl PRIVATE
.bd 1
.tl This information should not be disclosed to unauthorized persons.
.tl It is meant solely for use by authorized Bell System employees. \}
.el .ie \\n(!K=3 \{\
.ie t .bd1 3
.el .bd1 0
.tl BELL LABORATORIES PROPRIETARY
.bd 1
.tl Not for use or disclosure outside Bell Laboratories except by
.tl written approval of the director of the distributing organization. \}
.el .ie \\n(!K=4 \{\
.ie t .bd1 3
.el .bd1 0
.tl BELL LABORATORIES RESTRICTED
.bd 1
.tl The information herein is meant solely for use by authorized
.tl Bell Laboratories employees and is not to be disclosed to others. \}
.el .if \\n(!K=2 \{\
.ie t .bd1 3
.el .bd1 0
.tl NOTICE
.bd 1
.tl Not for use or disclosure outside the
.tl Bell System except under written agreement. \}
..
.nr )s 0
.if t .if \ns .nr )s 1
.nr )t 0
.if t .if !\ns .nr )t 1
.if \n()s \{.nr )L 9i
.nr LL 4.75i
.nr )O .75i
.nr )S 8
.nr )V 9 \}
.if \n()t \{.nr )L 11i
.nr LL 6.5i
.nr )O 1i
.nr )S 9
.nr )V 11 \}
.if t \{.ds R ®
.ds S \s\n()S
.ds lq “
.ds rq ”
..\}
.if n \{.ie \nL<=0 .nr )L 11i
.el \{.nr )L \nLu
.nr V 0\}
.nr LL 6.5i
.nr )O .463i
.if '\*(.T'think' \{.nrLL 80n
.nr )O 0\}
.if '\*(.T'thinksmall' \{.nrLL 142n
.vs 9p
.nr )O 0\}
.ds R (Reg.)
.ds S
.ds lq ``
.ds rq ''
.\" Insert definitions for non-utf troff-mode devices here.
.if '\*(.T'utf' \{.ds lq “
.ds rq ”
.\}
..\}
.if \nT .nr LL 80n
.if \nV>1 \{
.nr LL 82n
.nr )L 84v
.rm ul \}
.nr )p 0 1
.ds ]I \\\\n(]
.ds ]R \\\\n()
.if \nd0 .nr m \n(mo-1
.if \nm0 .ds ]m January
.if \nm1 .ds ]m February
.if \nm2 .ds ]m March
.if \nm3 .ds ]m April
.if \nm4 .ds ]m May
.if \nm5 .ds ]m June
.if \nm6 .ds ]m July
.if \nm7 .ds ]m August
.if \nm8 .ds ]m September
.if \nm9 .ds ]m October
.if \nm10 .ds ]m November
.if \nm11 .ds ]m December
.if n \{.nr m \nm+1
.nr yD (\n(yr%100
.af yD 01
.ie \nd .ds ]W (last mod. \nm/\nd/\ny)
.el .ds ]W (printed \n(mo/\n(dy/\n(yD)
..\}
.if \n()s .ds ]W
.if \n()t \{.ie \nd .ds ]W \*(]m \nd, 20\ny
.el .ds ]W \*(]m \n(dy, 20\n(yr
..\}
.pl \n()Lu
.ll \n(LLu
.lt \n(LLu
.po \n()Ou
.if t .tr \``\''
.}f
.if \n()s .nr :m 3.5v
.if \n()t .nr :m 6v
.if n .nr :m 7v
.if t .nr )M 3.6m
.if n .nr )M 5n
.em }K
.nr q \np
.if !\np .nr p 1
.pn \np