diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-11-14 10:07:06 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-11-14 10:07:06 +0000 |
commit | e9953015c778f622a13fba9e080726213b842410 (patch) | |
tree | 75829e98ca3c206a02f366e8b8adc6d8c985c6d9 /apropos_db.c | |
parent | 5ef01561d45c2fa2522c7bb1151fd40ac6e6de19 (diff) | |
download | mandoc-e9953015c778f622a13fba9e080726213b842410.tar.gz |
Have exprcomp() accept a string instead of an array-pointer. Also, collapse
the arguments in apropos(1) into a single string passed to exprcomp(). Ok
schwarze@.
Diffstat (limited to 'apropos_db.c')
-rw-r--r-- | apropos_db.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apropos_db.c b/apropos_db.c index aa4d54c4..94985c9b 100644 --- a/apropos_db.c +++ b/apropos_db.c @@ -454,23 +454,23 @@ out: } struct expr * -exprcomp(int argc, char *argv[]) +exprcomp(char *buf) { struct expr *p; struct expr e; char *key; int i, icase; - if (0 >= argc) + if ('\0' == *buf) return(NULL); /* * Choose regex or substring match. */ - if (NULL == (e.v = strpbrk(*argv, "=~"))) { + if (NULL == (e.v = strpbrk(buf, "=~"))) { e.regex = 0; - e.v = *argv; + e.v = buf; } else { e.regex = '~' == *e.v; *e.v++ = '\0'; @@ -482,15 +482,15 @@ exprcomp(int argc, char *argv[]) icase = 0; e.mask = 0; - if (*argv < e.v) { - while (NULL != (key = strsep(argv, ","))) { + if (buf < e.v) { + while (NULL != (key = strsep(&buf, ","))) { if ('i' == key[0] && '\0' == key[1]) { icase = REG_ICASE; continue; } i = 0; while (types[i].mask && - strcmp(types[i].name, key)) + strcmp(types[i].name, key)) i++; e.mask |= types[i].mask; } |