Subject: Re: groff update?
To: Thomas Klausner <wiz@netbsd.org>
From: Christian Limpach <chris@pin.lu>
List: tech-userlevel
Date: 02/19/2003 04:58:48
Quoting Thomas Klausner <wiz@netbsd.org>:

> On Tue, Feb 18, 2003 at 11:29:37AM -0500, Perry E. Metzger wrote:
> > If they are under a plain BSD license, then I suggest we switch to
> > them, and deal with the consequences. I would suggest that we remove
> > the .Nm "" from our own man pages, but that we put in a patch into the
> > version we keep to allow that in order to allow formatting of old pages.
> 
> Christian Limpach's patch from earlier today allows us to switch (thanks,
> Christian!).

there was a small bug in that patch, updated version below...

> We should have a patch for the 1.5 and 1.6 branches before we remove the
> .Nm "", though, to allow them to format -current man pages correctly.

the 2nd patch below makes 1.6' tmac.doc handle '.Nm ,' like '.Nm "" ,'.  It 
makes .Nm output the command-name additionally when the first argument's type 
is punctuation.   This works at least for the test cases I tried...

groff 1.18.1 patch:
--- tmac/doc.tmac.orig  Fri Jul  5 16:37:21 2002
+++ tmac/doc.tmac
@@ -906,8 +906,17 @@
 .de Nm
 .  if !\n[doc-arg-limit] \{\
 .    ds doc-macro-name Nm
-.    ie \n[.$] \
+.    ie \n[.$] \{\
 .      doc-parse-args \$@
+.      nr doc-arg-ptr +1
+.      if "\*[doc-arg\n[doc-arg-ptr]]"" \{\
+.        ie "\*[doc-command-name]"" \
+.          tm Usage: .Nm name ... (#\n[.c])
+.        el \
+.          ds doc-arg\n[doc-arg-ptr] \*[doc-command-name]
+.      \}
+.      nr doc-arg-ptr -1
+.    \}
 .    el \{\
 .      ie "\*[doc-command-name]"" \
 .        tm Usage: .Nm name ... (#\n[.c])


patch for 1.6
Index: doc
===================================================================
RCS file: /cvsroot/src/share/tmac/doc,v
retrieving revision 1.26
diff -u -r1.26 doc
--- doc	2002/01/03 16:30:16	1.26
+++ doc	2003/02/19 03:39:07
@@ -792,17 +792,35 @@
 .	\}
 .	el \{\
 .		ds mN Nm
-.		ie "\\$1"" .ds A1 \\*(n1
-.		el .ds A1 \\$1
-.		ds A2 \\$2
-.		ds A3 \\$3
-.		ds A4 \\$4
-.		ds A5 \\$5
-.		ds A6 \\$6
-.		ds A7 \\$7
-.		ds A8 \\$8
-.		ds A9 \\$9
-.		nr fV \\n(.$
+.		sW "\\$1"
+.		aT \\$1
+.		ie \\n(aT==3:\\n(aT==4 \{\
+.			ds A1 \\*(n1
+.			ds A2 \\$1
+.			ds A3 \\$2
+.			ds A4 \\$3
+.			ds A5 \\$4
+.			ds A6 \\$5
+.			ds A7 \\$6
+.			ds A8 \\$7
+.			ds A9 \\$8
+.			if !"\\$9"" .as A9 " \\$9
+.			nr fV \\n(.$
+.			if \\n(fV<9 .nr fV \\n(fV+1
+.		\}
+.		el \{\
+.			ie "\\$1"" .ds A1 \\*(n1
+.			el .ds A1 \\$1
+.			ds A2 \\$2
+.			ds A3 \\$3
+.			ds A4 \\$4
+.			ds A5 \\$5
+.			ds A6 \\$6
+.			ds A7 \\$7
+.			ds A8 \\$8
+.			ds A9 \\$9
+.			nr fV \\n(.$
+.		\}
 .		fV
 .	\}
 .\}

-- 
Christian Limpach <chris@pin.lu>