Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Oct 2001 19:10:59 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Murray Stokely <murray@FreeBSD.org>, Sheldon Hearn <sheldonh@FreeBSD.org>, Alexey Zelkin <phantom@cris.net>, Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>, Mike Pritchard <mpp@FreeBSD.org>
Cc:        doc@FreeBSD.org
Subject:   Re: Referencing man pages from ports/
Message-ID:  <20011008191058.B13684@sunbay.com>
In-Reply-To: <20011008013845.M21516@windriver.com>; from murray@FreeBSD.ORG on Mon, Oct 08, 2001 at 01:38:45AM -0700
References:  <20011007214038.E21516@windriver.com> <20011008110956.E36543@sunbay.com> <20011008012121.L21516@windriver.com> <20011008113057.G36543@sunbay.com> <20011008013845.M21516@windriver.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Mon, Oct 08, 2001 at 01:38:45AM -0700, Murray Stokely wrote:
> On Mon, Oct 08, 2001 at 11:30:57AM +0300, Ruslan Ermilov wrote:
> > Yes.  The call will look like this:
> > 
> > .Pxr cvsup 1 net cvsup
> > 
> > And will be rendered like this:
> > 
> > .Xr cvsup 1
> > .Pq Pa ports/net/cvsup
> 
>   This sounds great to me.  
> 
OK, the attached patch is against RELENG_4 but should also apply
with fuzzes to HEAD as well.  You'll need to:

# cd /usr/src
# patch -st </tmp/p
# cd gnu/usr.bin/groff/tmac
# make all install

The patch was developed to fit OpenBSD and NetBSD requirements.
For example, NetBSD will redefine the `doc-str-Xr-ports' string
variable (in mdoc.local) as follows:

.ds doc-str-Xr-ports pkgsrc

Here's the usage example.  The .Xr macro will auto-check the
category and warn if the Ports category is not registered
with mdoc(7) or its name is misspelled.

Index: firewall.7
===================================================================
RCS file: /home/ncvs/src/share/man/man7/firewall.7,v
retrieving revision 1.6
diff -u -r1.6 firewall.7
--- firewall.7	2001/07/14 19:41:13	1.6
+++ firewall.7	2001/10/08 16:00:13
@@ -350,8 +350,8 @@
 .Xr dummynet 4 ,
 .Xr ipnat 5 ,
 .Xr rc.conf 5 ,
-.Xr smb.conf 5 [ /usr/ports/net/samba ] ,
-.Xr samba 7 [ /usr/ports/net/samba ] ,
+.Xr smb.conf 5 net samba ,
+.Xr samba 7 net samba ,
 .Xr config 8 ,
 .Xr ipfw 8 ,
 .Xr jail 8 ,


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

[-- Attachment #2 --]
Index: contrib/groff/tmac/doc.tmac
===================================================================
RCS file: /home/ncvs/src/contrib/groff/tmac/doc.tmac,v
retrieving revision 1.1.1.1.2.4
diff -u -p -r1.1.1.1.2.4 doc.tmac
--- contrib/groff/tmac/doc.tmac	2001/08/16 06:53:08	1.1.1.1.2.4
+++ contrib/groff/tmac/doc.tmac	2001/10/08 15:42:06
@@ -4160,12 +4160,19 @@
 .\" NS modifies:
 .\" NS   doc-arg-ptr
 .\" NS   doc-macro-name
+.\" NS   doc-argXXX
+.\" NS   doc-spaceXXX
 .\" NS
 .\" NS local variables:
 .\" NS   doc-reg-Xr
+.\" NS   doc-reg-Xr1
+.\" NS   doc-str-Xr-ports
+.\" NS   doc-str-Xr-ports-XXX
 .\" NS
 .\" NS width register `Xr' set in doc-common
 .
+.ds doc-str-Xr-ports ports
+.
 .de Xr
 .  if !\n[doc-arg-limit] \{\
 .    ie \n[.$] \{\
@@ -4195,8 +4202,20 @@
 .        if (\n[doc-type\n[doc-reg-Xr]] == 2) \{\
 .          ds doc-arg\n[doc-reg-Xr] \*[lp]\*[doc-arg\n[doc-reg-Xr]]\*[rp]
 .          ds doc-space\n[doc-arg-ptr]
-.        \}
-.      \}
+.          \" check for "ports" syntax
+.          nr doc-reg-Xr +1
+.          if (\n[doc-arg-limit] > \n[doc-reg-Xr]) \{\
+.            nr doc-reg-Xr1 (\n[doc-reg-Xr] + 1)
+.            if ((\n[doc-type\n[doc-reg-Xr]] == 2) & (\n[doc-type\n[doc-reg-Xr1]] == 2)) \{\
+.              if \A\*[doc-arg\n[doc-reg-Xr]] \{\
+.                if !d doc-str-Xr-ports-\*[doc-arg\n[doc-reg-Xr]] \{\
+.                  tmc mdoc warning: .Xr: Unknown \*[doc-str-Xr-ports] category
+.                  tm1 " `\*[doc-arg\n[doc-reg-Xr]]' (#\n[.c])
+.              \}\}
+.              ds doc-arg\n[doc-reg-Xr] \*[doc-left-bracket]\*[doc-Pa-font]\*[doc-str-Xr-ports]/\*[doc-arg\n[doc-reg-Xr]]/
+.              ds doc-space\n[doc-reg-Xr]
+.              as doc-arg\n[doc-reg-Xr1] \f[P]\s[0]\*[doc-right-bracket]
+.      \}\}\}\}
 .      doc-print-recursive
 .    \}
 .    el \
@@ -4210,7 +4229,7 @@
 .\" NS doc-Xr-usage macro
 .
 .de doc-Xr-usage
-.  tm Usage: .Xr manpage_name [section#] ... (#\n[.c])
+.  tm Usage: .Xr manpage_name [section# [category port]] ... (#\n[.c])
 .  doc-reset-args
 ..
 .
Index: gnu/usr.bin/groff/tmac/mdoc.local
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/groff/tmac/mdoc.local,v
retrieving revision 1.2.2.3
diff -u -p -r1.2.2.3 mdoc.local
--- gnu/usr.bin/groff/tmac/mdoc.local	2001/08/06 17:05:49	1.2.2.3
+++ gnu/usr.bin/groff/tmac/mdoc.local	2001/10/08 15:42:06
@@ -56,6 +56,58 @@
 .ds doc-str-Lb-libusb      USB HID access routines library (libusb, \-lusb)
 .ds doc-str-Lb-libvgl      Video Graphics Library (libvgl, \-lvgl)
 .
+.\" FreeBSD Ports Collection categories
+.ds doc-str-Xr-ports-archivers
+.ds doc-str-Xr-ports-astro
+.ds doc-str-Xr-ports-audio
+.ds doc-str-Xr-ports-benchmarks
+.ds doc-str-Xr-ports-biology
+.ds doc-str-Xr-ports-cad
+.ds doc-str-Xr-ports-chinese
+.ds doc-str-Xr-ports-comms
+.ds doc-str-Xr-ports-converters
+.ds doc-str-Xr-ports-databases
+.ds doc-str-Xr-ports-deskutils
+.ds doc-str-Xr-ports-devel
+.ds doc-str-Xr-ports-editors
+.ds doc-str-Xr-ports-emulators
+.ds doc-str-Xr-ports-french
+.ds doc-str-Xr-ports-ftp
+.ds doc-str-Xr-ports-games
+.ds doc-str-Xr-ports-german
+.ds doc-str-Xr-ports-graphics
+.ds doc-str-Xr-ports-hebrew
+.ds doc-str-Xr-ports-irc
+.ds doc-str-Xr-ports-japanese
+.ds doc-str-Xr-ports-java
+.ds doc-str-Xr-ports-korean
+.ds doc-str-Xr-ports-lang
+.ds doc-str-Xr-ports-mail
+.ds doc-str-Xr-ports-math
+.ds doc-str-Xr-ports-mbone
+.ds doc-str-Xr-ports-misc
+.ds doc-str-Xr-ports-net
+.ds doc-str-Xr-ports-news
+.ds doc-str-Xr-ports-palm
+.ds doc-str-Xr-ports-picobsd
+.ds doc-str-Xr-ports-print
+.ds doc-str-Xr-ports-russian
+.ds doc-str-Xr-ports-science
+.ds doc-str-Xr-ports-security
+.ds doc-str-Xr-ports-shells
+.ds doc-str-Xr-ports-sysutils
+.ds doc-str-Xr-ports-textproc
+.ds doc-str-Xr-ports-ukrainian
+.ds doc-str-Xr-ports-vietnamese
+.ds doc-str-Xr-ports-www
+.ds doc-str-Xr-ports-x11
+.ds doc-str-Xr-ports-x11-clocks
+.ds doc-str-Xr-ports-x11-fm
+.ds doc-str-Xr-ports-x11-fonts
+.ds doc-str-Xr-ports-x11-servers
+.ds doc-str-Xr-ports-x11-toolkits
+.ds doc-str-Xr-ports-x11-wm
+.
 .\" Default .Os value
 .ds doc-operating-system FreeBSD\~4.4
 .
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011008191058.B13684>