source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Add cross-reference records to makewhatis.
@ 2011-06-25 13:19 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-06-25 13:19 UTC (permalink / raw)
  To: source

Log Message:
-----------
Add cross-reference records to makewhatis.

Modified Files:
--------------
    mdocml:
        makewhatis.1
        makewhatis.c

Revision Data
-------------
Index: makewhatis.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/makewhatis.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lmakewhatis.c -Lmakewhatis.c -u -p -r1.10 -r1.11
--- makewhatis.c
+++ makewhatis.c
@@ -54,6 +54,7 @@
 #define TYPE_AUTHOR	  0x40
 #define TYPE_CONFIG	  0x80
 #define TYPE_DESC	  0x100
+#define TYPE_XREF	  0x200
 
 /* Buffer for storing growable data. */
 
@@ -90,6 +91,7 @@ static	void		  pmdoc_Nd(MDOC_ARGS);
 static	void		  pmdoc_Nm(MDOC_ARGS);
 static	void		  pmdoc_St(MDOC_ARGS);
 static	void		  pmdoc_Vt(MDOC_ARGS);
+static	void		  pmdoc_Xr(MDOC_ARGS);
 static	void		  usage(void);
 
 typedef	void		(*pmdoc_nf)(MDOC_ARGS);
@@ -135,7 +137,7 @@ static	const pmdoc_nf	  mdocs[MDOC_MAX] 
 	pmdoc_St, /* St */ 
 	pmdoc_Vt, /* Va */
 	pmdoc_Vt, /* Vt */ 
-	NULL, /* Xr */ 
+	pmdoc_Xr, /* Xr */ 
 	NULL, /* %A */
 	NULL, /* %B */
 	NULL, /* %D */
@@ -648,6 +650,25 @@ pmdoc_St(MDOC_ARGS)
 
 	buf_append(buf, n->child->string);
 	hash_put(hash, buf, TYPE_STANDARD);
+}
+
+/* ARGSUSED */
+static void
+pmdoc_Xr(MDOC_ARGS)
+{
+
+	if (NULL == (n = n->child))
+		return;
+
+	buf_appendb(buf, n->string, strlen(n->string));
+
+	if (NULL != (n = n->next)) {
+		buf_appendb(buf, ".", 1);
+		buf_appendb(buf, n->string, strlen(n->string) + 1);
+	} else
+		buf_appendb(buf, ".", 2);
+
+	hash_put(hash, buf, TYPE_XREF);
 }
 
 /* ARGSUSED */
Index: makewhatis.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/makewhatis.1,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lmakewhatis.1 -Lmakewhatis.1 -u -p -r1.6 -r1.7
--- makewhatis.1
+++ makewhatis.1
@@ -114,6 +114,10 @@ An author as given in the AUTHORS sectio
 A configuration as given in the SYNOPSIS section.
 .It Li 0x100
 Free-form descriptive text as given in the NAME section.
+.It Li 0x200
+Cross-links between manuals.
+Listed as the link name, then a period, then the link section.
+If the link has no section, the period terminates the string.
 .El
 .Pp
 The last four bytes are a host-ordered record number within the
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-25 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-25 13:19 mdocml: Add cross-reference records to makewhatis kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).