bin/86343: [patch] tmac.vgrind: groff cleanup broke indexing

Matej Vela vela at debian.org
Mon Sep 19 11:30:10 PDT 2005


>Number:         86343
>Category:       bin
>Synopsis:       [patch] tmac.vgrind: groff cleanup broke indexing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 19 18:30:07 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Matej Vela
>Release:        FreeBSD-CURRENT
>Organization:
Debian
>Environment:
N/A

>Description:
In revision 1.2 of src/usr.bin/vgrind/tmac.vgrind, the following change
was made to eliminate warnings from groff(1):

--- src/usr.bin/vgrind/tmac.vgrind	1994/05/27 12:33:20	1.1
+++ src/usr.bin/vgrind/tmac.vgrind	2000/11/29 10:32:51	1.2
@@ -54,11 +58,9 @@
 ..
 'de FN
 \f2\s14\h'\\n(.lu-\w'\\$1'u'\\$1\fP\s0\h'|0u'\c
-.if \\nx .tm \\$1 \\*(=F \\n%
 'ds =f \&...\\$1
 ..
 'de FC
-.if \\nx .tm \\$1 \\*(=F \\n%
 'ds =f \&...\\$1
 ..
 'de -F

What the two removed lines say in their wonderfully concise way is, if
the numeric register `x' is non-zero [1], output the function name [2],
the name of the current file [3], and the current page number [4] to the
index file [5] for a second pass by `vgrind -x'.

[1] I.e. if vgrind.sh invoked groff(1) with `-rx1' to enable indexing.
[2] `\$1', the first argument to FN and FC.
[3] Variable `=F', defined by vfontedpr.c:271.
[4] Register `%', maintained by groff(1) itself.
[5] Or to be precise, to standard error, which vgrind.sh redirects to
    the index file.

The reason they were removed is that they cause `register not defined'
warnings if vgrind.sh doesn't supply `-rx1'.  However, removing them
completely breaks indexing.

>How-To-Repeat:
$ cd src/usr.bin/vgrind
$ > index
$ vgrind -p groff vgrindefs.c > source.ps
$ file index
index: empty

The correct behavior looks like this:

$ > index
$ vgrind -p groff vgrindefs.c > source.ps
$ cat index
tdecode vgrindefs.c 5
tgetent vgrindefs.c 2
tgetflag vgrindefs.c 4
tgetnum vgrindefs.c 4
tgetstr vgrindefs.c 5
tnamatch vgrindefs.c 3
tnchktc vgrindefs.c 3
tskip vgrindefs.c 4
$ vgrind -p groff -x index > index.ps

>Fix:
Fix the groff(1) warnings without removing the offending lines, by making
sure `\nx' and `\*(=F' are used only when defined (`if r x', `if d =F'):

--- src/usr.bin/vgrind/tmac.vgrind.orig
+++ src/usr.bin/vgrind/tmac.vgrind
@@ -58,9 +58,11 @@
 ..
 'de FN
 \f2\s14\h'\\n(.lu-\w'\\$1'u'\\$1\fP\s0\h'|0u'\c
+.if r x .if \\nx .if d =F .tm \\$1 \\*(=F \\n%
 'ds =f \&...\\$1
 ..
 'de FC
+.if r x .if \\nx .if d =F .tm \\$1 \\*(=F \\n%
 'ds =f \&...\\$1
 ..
 'de -F
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list