aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apropos_db.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-11-14 10:07:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-11-14 10:07:06 +0000
commit0bf960c1fb936cb28f39f7d7c2b1b2817ebb14a0 (patch)
tree5d0fed038d44a8a49a97a2134db6ec9941f97b3c /apropos_db.c
parentee8f80a2285cf242861f49768d05d2efe5c1688b (diff)
downloadmandoc-0bf960c1fb936cb28f39f7d7c2b1b2817ebb14a0.tar.gz
mandoc-0bf960c1fb936cb28f39f7d7c2b1b2817ebb14a0.tar.zst
mandoc-0bf960c1fb936cb28f39f7d7c2b1b2817ebb14a0.zip
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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/apropos_db.c b/apropos_db.c
index 89b21fbb..1c2cb4f4 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -1,4 +1,4 @@
-/* $Id: apropos_db.c,v 1.3 2011/11/13 11:10:27 schwarze Exp $ */
+/* $Id: apropos_db.c,v 1.4 2011/11/14 10:07:06 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}