summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-04 15:55:18 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-04 15:55:18 +0000
commit4c6637de7c42bfa7ba30c2d230466bbf52847432 (patch)
treebb6742c80577c14fa6642b398f41aba052bb125b /usr.bin
parent7cf0aa4b5e47a8ad16bb6fa7a1f19d67771caeb2 (diff)
Remember which names are in the NAME section.
This helps to find missing MLINKS. Database build times do not change and database growth is minimal (1.2% with -Q, 0.7% without -Q in /usr/share/man), so making this optional would be pointless.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/apropos.18
-rw-r--r--usr.bin/mandoc/mandocdb.c15
-rw-r--r--usr.bin/mandoc/mansearch.h85
-rw-r--r--usr.bin/mandoc/mansearch_const.c17
4 files changed, 66 insertions, 59 deletions
diff --git a/usr.bin/mandoc/apropos.1 b/usr.bin/mandoc/apropos.1
index 57714849be1..ab908a3d0e6 100644
--- a/usr.bin/mandoc/apropos.1
+++ b/usr.bin/mandoc/apropos.1
@@ -1,6 +1,7 @@
-.\" $Id: apropos.1,v 1.20 2014/03/17 11:29:11 schwarze Exp $
+.\" $Id: apropos.1,v 1.21 2014/04/04 15:55:17 schwarze Exp $
.\"
-.\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
+.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+.\" Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 17 2014 $
+.Dd $Mdocdate: April 4 2014 $
.Dt APROPOS 1
.Os
.Sh NAME
@@ -185,6 +186,7 @@ may be used to match any available macro key.
.Pp
Names and description:
.Bl -column "xLix" description -offset indent -compact
+.It Li NAME Ta manual name in the NAME section, subset of \&Nm
.It Li \&Nm Ta manual name
.It Li \&Nd Ta one-line manual description
.It Li arch Ta machine architecture (case-insensitive)
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index ced3c83771d..4c72000b23d 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.85 2014/04/04 02:31:01 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.86 2014/04/04 15:55:17 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -216,7 +216,7 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = {
{ NULL, TYPE_In }, /* In */
{ NULL, TYPE_Li }, /* Li */
{ parse_mdoc_Nd, TYPE_Nd }, /* Nd */
- { parse_mdoc_Nm, TYPE_Nm }, /* Nm */
+ { parse_mdoc_Nm, 0 }, /* Nm */
{ NULL, 0 }, /* Op */
{ NULL, 0 }, /* Ot */
{ NULL, TYPE_Pa }, /* Pa */
@@ -1389,7 +1389,7 @@ parse_man(struct mpage *mpage, const struct man_node *n)
('\\' == start[0] && '-' == start[1]))
break;
- putkey(mpage, start, TYPE_Nm);
+ putkey(mpage, start, TYPE_NAME | TYPE_Nm);
if (' ' == byte) {
start += sz + 1;
@@ -1403,7 +1403,7 @@ parse_man(struct mpage *mpage, const struct man_node *n)
}
if (start == title) {
- putkey(mpage, start, TYPE_Nm);
+ putkey(mpage, start, TYPE_NAME | TYPE_Nm);
free(title);
return;
}
@@ -1580,8 +1580,11 @@ static int
parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_node *n)
{
- return(SEC_NAME == n->sec ||
- (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type));
+ if (SEC_NAME == n->sec)
+ putmdockey(mpage, n->child, TYPE_NAME | TYPE_Nm);
+ else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type)
+ putmdockey(mpage, n->child, TYPE_Nm);
+ return(0);
}
static int
diff --git a/usr.bin/mandoc/mansearch.h b/usr.bin/mandoc/mansearch.h
index e6f96e0385a..d2a6a2f9cef 100644
--- a/usr.bin/mandoc/mansearch.h
+++ b/usr.bin/mandoc/mansearch.h
@@ -1,7 +1,7 @@
-/* $Id: mansearch.h,v 1.5 2014/01/17 19:22:45 schwarze Exp $ */
+/* $Id: mansearch.h,v 1.6 2014/04/04 15:55:17 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,46 +20,47 @@
#define MANDOC_DB "mandoc.db"
-#define TYPE_Nm 0x0000000000000001ULL
-#define TYPE_Nd 0x0000000000000002ULL
-#define TYPE_arch 0x0000000000000004ULL
-#define TYPE_sec 0x0000000000000008ULL
-#define TYPE_Xr 0x0000000000000010ULL
-#define TYPE_Ar 0x0000000000000020ULL
-#define TYPE_Fa 0x0000000000000040ULL
-#define TYPE_Fl 0x0000000000000080ULL
-#define TYPE_Dv 0x0000000000000100ULL
-#define TYPE_Fn 0x0000000000000200ULL
-#define TYPE_Ic 0x0000000000000400ULL
-#define TYPE_Pa 0x0000000000000800ULL
-#define TYPE_Cm 0x0000000000001000ULL
-#define TYPE_Li 0x0000000000002000ULL
-#define TYPE_Em 0x0000000000004000ULL
-#define TYPE_Cd 0x0000000000008000ULL
-#define TYPE_Va 0x0000000000010000ULL
-#define TYPE_Ft 0x0000000000020000ULL
-#define TYPE_Tn 0x0000000000040000ULL
-#define TYPE_Er 0x0000000000080000ULL
-#define TYPE_Ev 0x0000000000100000ULL
-#define TYPE_Sy 0x0000000000200000ULL
-#define TYPE_Sh 0x0000000000400000ULL
-#define TYPE_In 0x0000000000800000ULL
-#define TYPE_Ss 0x0000000001000000ULL
-#define TYPE_Ox 0x0000000002000000ULL
-#define TYPE_An 0x0000000004000000ULL
-#define TYPE_Mt 0x0000000008000000ULL
-#define TYPE_St 0x0000000010000000ULL
-#define TYPE_Bx 0x0000000020000000ULL
-#define TYPE_At 0x0000000040000000ULL
-#define TYPE_Nx 0x0000000080000000ULL
-#define TYPE_Fx 0x0000000100000000ULL
-#define TYPE_Lk 0x0000000200000000ULL
-#define TYPE_Ms 0x0000000400000000ULL
-#define TYPE_Bsx 0x0000000800000000ULL
-#define TYPE_Dx 0x0000001000000000ULL
-#define TYPE_Rs 0x0000002000000000ULL
-#define TYPE_Vt 0x0000004000000000ULL
-#define TYPE_Lb 0x0000008000000000ULL
+#define TYPE_NAME 0x0000000000000001ULL
+#define TYPE_Nm 0x0000000000000002ULL
+#define TYPE_Nd 0x0000000000000004ULL
+#define TYPE_arch 0x0000000000000008ULL
+#define TYPE_sec 0x0000000000000010ULL
+#define TYPE_Xr 0x0000000000000020ULL
+#define TYPE_Ar 0x0000000000000040ULL
+#define TYPE_Fa 0x0000000000000080ULL
+#define TYPE_Fl 0x0000000000000100ULL
+#define TYPE_Dv 0x0000000000000200ULL
+#define TYPE_Fn 0x0000000000000400ULL
+#define TYPE_Ic 0x0000000000000800ULL
+#define TYPE_Pa 0x0000000000001000ULL
+#define TYPE_Cm 0x0000000000002000ULL
+#define TYPE_Li 0x0000000000004000ULL
+#define TYPE_Em 0x0000000000008000ULL
+#define TYPE_Cd 0x0000000000010000ULL
+#define TYPE_Va 0x0000000000020000ULL
+#define TYPE_Ft 0x0000000000040000ULL
+#define TYPE_Tn 0x0000000000080000ULL
+#define TYPE_Er 0x0000000000100000ULL
+#define TYPE_Ev 0x0000000000200000ULL
+#define TYPE_Sy 0x0000000000400000ULL
+#define TYPE_Sh 0x0000000000800000ULL
+#define TYPE_In 0x0000000001000000ULL
+#define TYPE_Ss 0x0000000002000000ULL
+#define TYPE_Ox 0x0000000004000000ULL
+#define TYPE_An 0x0000000008000000ULL
+#define TYPE_Mt 0x0000000010000000ULL
+#define TYPE_St 0x0000000020000000ULL
+#define TYPE_Bx 0x0000000040000000ULL
+#define TYPE_At 0x0000000080000000ULL
+#define TYPE_Nx 0x0000000100000000ULL
+#define TYPE_Fx 0x0000000200000000ULL
+#define TYPE_Lk 0x0000000400000000ULL
+#define TYPE_Ms 0x0000000800000000ULL
+#define TYPE_Bsx 0x0000001000000000ULL
+#define TYPE_Dx 0x0000002000000000ULL
+#define TYPE_Rs 0x0000004000000000ULL
+#define TYPE_Vt 0x0000008000000000ULL
+#define TYPE_Lb 0x0000010000000000ULL
__BEGIN_DECLS
diff --git a/usr.bin/mandoc/mansearch_const.c b/usr.bin/mandoc/mansearch_const.c
index f90c89609e5..beff5610cee 100644
--- a/usr.bin/mandoc/mansearch_const.c
+++ b/usr.bin/mandoc/mansearch_const.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch_const.c,v 1.1 2014/01/19 00:09:33 schwarze Exp $ */
+/* $Id: mansearch_const.c,v 1.2 2014/04/04 15:55:17 schwarze Exp $ */
/*
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -20,12 +20,13 @@
#include "manpath.h"
#include "mansearch.h"
-const int mansearch_keymax = 40;
+const int mansearch_keymax = 41;
-const char *const mansearch_keynames[40] = {
- "Nm", "Nd", "arch", "sec", "Xr", "Ar", "Fa", "Fl",
- "Dv", "Fn", "Ic", "Pa", "Cm", "Li", "Em", "Cd",
- "Va", "Ft", "Tn", "Er", "Ev", "Sy", "Sh", "In",
- "Ss", "Ox", "An", "Mt", "St", "Bx", "At", "Nx",
- "Fx", "Lk", "Ms", "Bsx", "Dx", "Rs", "Vt", "Lb"
+const char *const mansearch_keynames[41] = {
+ "NAME", "Nm", "Nd", "arch", "sec", "Xr", "Ar", "Fa",
+ "Fl", "Dv", "Fn", "Ic", "Pa", "Cm", "Li", "Em",
+ "Cd", "Va", "Ft", "Tn", "Er", "Ev", "Sy", "Sh",
+ "In", "Ss", "Ox", "An", "Mt", "St", "Bx", "At",
+ "Nx", "Fx", "Lk", "Ms", "Bsx", "Dx", "Rs", "Vt",
+ "Lb"
};