diff options
Diffstat (limited to 'mansearch.c')
-rw-r--r-- | mansearch.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mansearch.c b/mansearch.c index 43fe8984..d42b97fb 100644 --- a/mansearch.c +++ b/mansearch.c @@ -590,7 +590,7 @@ exprcomp(const struct mansearch *search, int argc, char *argv[]) first = cur = NULL; logic = igncase = toclose = 0; - toopen = 1; + toopen = NULL != search->sec || NULL != search->arch; for (i = 0; i < argc; i++) { if (0 == strcmp("(", argv[i])) { @@ -659,9 +659,12 @@ exprcomp(const struct mansearch *search, int argc, char *argv[]) if (toopen || logic || igncase || toclose) goto fail; - cur->close++; - cur = exprspec(cur, TYPE_arch, search->arch, "^(%s|any)$"); - exprspec(cur, TYPE_sec, search->sec, "^%s$"); + if (NULL != search->sec || NULL != search->arch) + cur->close++; + if (NULL != search->arch) + cur = exprspec(cur, TYPE_arch, search->arch, "^(%s|any)$"); + if (NULL != search->sec) + exprspec(cur, TYPE_sec, search->sec, "^%s$"); return(first); @@ -679,9 +682,6 @@ exprspec(struct expr *cur, uint64_t key, const char *value, char *cp; int irc; - if (NULL == value) - return(cur); - mandoc_asprintf(&cp, format, value); cur->next = mandoc_calloc(1, sizeof(struct expr)); cur = cur->next; |