summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mansearch.c67
-rw-r--r--mdoc_validate.c7
2 files changed, 51 insertions, 23 deletions
diff --git a/mansearch.c b/mansearch.c
index c889aecf..44a4efa7 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
+/* $Id$ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -171,7 +171,9 @@ mansearch(const struct mansearch *search,
page = dbm_page_get(rp->page);
if (lstmatch(search->sec, page->sect) == 0 ||
- lstmatch(search->arch, page->arch) == 0)
+ lstmatch(search->arch, page->arch) == 0 ||
+ (search->argmode == ARG_NAME &&
+ rp->bits <= (int32_t)(NAME_SYN & NAME_MASK)))
continue;
if (res == NULL) {
@@ -452,14 +454,28 @@ lstlen(const char *cp, size_t sep)
{
size_t sz;
- for (sz = 0;; sz++) {
- if (cp[0] == '\0') {
- if (cp[1] == '\0')
- break;
- sz += sep - 1;
- } else if (cp[0] < ' ')
- sz--;
- cp++;
+ for (sz = 0; *cp != '\0'; cp++) {
+
+ /* Skip names appearing only in the SYNOPSIS. */
+ if (*cp <= (char)(NAME_SYN & NAME_MASK)) {
+ while (*cp != '\0')
+ cp++;
+ continue;
+ }
+
+ /* Skip name class markers. */
+ if (*cp < ' ')
+ cp++;
+
+ /* Print a separator before each but the first string. */
+ if (sz)
+ sz += sep;
+
+ /* Copy one string. */
+ while (*cp != '\0') {
+ sz++;
+ cp++;
+ }
}
return sz;
}
@@ -471,19 +487,34 @@ lstlen(const char *cp, size_t sep)
static void
lstcat(char *buf, size_t *i, const char *cp, const char *sep)
{
- const char *s;
+ const char *s;
+ size_t i_start;
- for (;;) {
- if (cp[0] == '\0') {
- if (cp[1] == '\0')
- break;
+ for (i_start = *i; *cp != '\0'; cp++) {
+
+ /* Skip names appearing only in the SYNOPSIS. */
+ if (*cp <= (char)(NAME_SYN & NAME_MASK)) {
+ while (*cp != '\0')
+ cp++;
+ continue;
+ }
+
+ /* Skip name class markers. */
+ if (*cp < ' ')
+ cp++;
+
+ /* Print a separator before each but the first string. */
+ if (*i > i_start) {
s = sep;
while (*s != '\0')
buf[(*i)++] = *s++;
- } else if (cp[0] >= ' ')
- buf[(*i)++] = cp[0];
- cp++;
+ }
+
+ /* Copy one string. */
+ while (*cp != '\0')
+ buf[(*i)++] = *cp++;
}
+
}
/*
diff --git a/mdoc_validate.c b/mdoc_validate.c
index a0137509..fe238eef 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1137,8 +1137,6 @@ post_fname(POST_ARGS)
if ( ! (cp[0] == '\0' || (cp[0] == '(' && cp[1] == '*')))
mandoc_msg(MANDOCERR_FN_PAREN, mdoc->parse,
n->line, n->pos + pos, n->string);
- if (n->sec == SEC_SYNOPSIS && mdoc->meta.msec != NULL)
- mandoc_xr_add(mdoc->meta.msec, n->string, -1, -1);
}
static void
@@ -1205,9 +1203,8 @@ post_nm(POST_ARGS)
n = mdoc->last;
- if ((n->sec == SEC_NAME || n->sec == SEC_SYNOPSIS) &&
- n->child != NULL && n->child->type == ROFFT_TEXT &&
- mdoc->meta.msec != NULL)
+ if (n->sec == SEC_NAME && n->child != NULL &&
+ n->child->type == ROFFT_TEXT && mdoc->meta.msec != NULL)
mandoc_xr_add(mdoc->meta.msec, n->child->string, -1, -1);
if (n->last != NULL &&