summaryrefslogtreecommitdiffstats
path: root/apropos_db.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-11-29 10:53:42 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-11-29 10:53:42 +0000
commit34df86dc46608f2598c87e854a8b4fb6369129d9 (patch)
tree2134dd9a04b71e7dce49ed05769f493a210fa463 /apropos_db.c
parentba260b631b89ba11f9cb1397e777e91f3bb3438d (diff)
downloadmandoc-34df86dc46608f2598c87e854a8b4fb6369129d9.tar.gz
Make `-i' only apply to regular expressions. For the equality operator
(and thus the default), always use strcasestr(). Discussed on tech@ with schwarze@. While here, fix the apropos.c usage() message to be consistent with apropos(1) and clean up the EXAMPLES in apropos(1).
Diffstat (limited to 'apropos_db.c')
-rw-r--r--apropos_db.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/apropos_db.c b/apropos_db.c
index f1adf29c..3e8c71a2 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -52,7 +52,6 @@ struct expr {
int regex; /* is regex? */
int index; /* index in match array */
uint64_t mask; /* type-mask */
- int cs; /* is case-sensitive? */
int and; /* is rhs of logical AND? */
char *v; /* search value */
regex_t re; /* compiled re, if regex */
@@ -694,7 +693,6 @@ exprexpr(int argc, char *argv[], int *pos, int *lvl, size_t *tt)
++(*pos);
++(*lvl);
next = mandoc_calloc(1, sizeof(struct expr));
- next->cs = 1;
next->subexpr = exprexpr(argc, argv, pos, lvl, tt);
if (NULL == next->subexpr) {
free(next);
@@ -745,8 +743,6 @@ exprterm(char *buf, int cs)
memset(&e, 0, sizeof(struct expr));
- e.cs = cs;
-
/* Choose regex or substring match. */
if (NULL == (e.v = strpbrk(buf, "=~"))) {
@@ -818,13 +814,8 @@ exprmark(const struct expr *p, const char *cp,
if (p->regex) {
if (regexec(&p->re, cp, 0, NULL, 0))
continue;
- } else if (p->cs) {
- if (NULL == strstr(cp, p->v))
- continue;
- } else {
- if (NULL == strcasestr(cp, p->v))
- continue;
- }
+ } else if (NULL == strcasestr(cp, p->v))
+ continue;
if (NULL == ms)
return(1);