version 1.15, 2011/11/28 09:44:05 |
version 1.16, 2011/11/29 10:53:42 |
|
|
int regex; /* is regex? */ |
int regex; /* is regex? */ |
int index; /* index in match array */ |
int index; /* index in match array */ |
uint64_t mask; /* type-mask */ |
uint64_t mask; /* type-mask */ |
int cs; /* is case-sensitive? */ |
|
int and; /* is rhs of logical AND? */ |
int and; /* is rhs of logical AND? */ |
char *v; /* search value */ |
char *v; /* search value */ |
regex_t re; /* compiled re, if regex */ |
regex_t re; /* compiled re, if regex */ |
Line 694 exprexpr(int argc, char *argv[], int *pos, int *lvl, s |
|
Line 693 exprexpr(int argc, char *argv[], int *pos, int *lvl, s |
|
++(*pos); |
++(*pos); |
++(*lvl); |
++(*lvl); |
next = mandoc_calloc(1, sizeof(struct expr)); |
next = mandoc_calloc(1, sizeof(struct expr)); |
next->cs = 1; |
|
next->subexpr = exprexpr(argc, argv, pos, lvl, tt); |
next->subexpr = exprexpr(argc, argv, pos, lvl, tt); |
if (NULL == next->subexpr) { |
if (NULL == next->subexpr) { |
free(next); |
free(next); |
Line 745 exprterm(char *buf, int cs) |
|
Line 743 exprterm(char *buf, int cs) |
|
|
|
memset(&e, 0, sizeof(struct expr)); |
memset(&e, 0, sizeof(struct expr)); |
|
|
e.cs = cs; |
|
|
|
/* Choose regex or substring match. */ |
/* Choose regex or substring match. */ |
|
|
if (NULL == (e.v = strpbrk(buf, "=~"))) { |
if (NULL == (e.v = strpbrk(buf, "=~"))) { |
Line 818 exprmark(const struct expr *p, const char *cp, |
|
Line 814 exprmark(const struct expr *p, const char *cp, |
|
if (p->regex) { |
if (p->regex) { |
if (regexec(&p->re, cp, 0, NULL, 0)) |
if (regexec(&p->re, cp, 0, NULL, 0)) |
continue; |
continue; |
} else if (p->cs) { |
} else if (NULL == strcasestr(cp, p->v)) |
if (NULL == strstr(cp, p->v)) |
continue; |
continue; |
|
} else { |
|
if (NULL == strcasestr(cp, p->v)) |
|
continue; |
|
} |
|
|
|
if (NULL == ms) |
if (NULL == ms) |
return(1); |
return(1); |