summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apropos.c2
-rw-r--r--apropos_db.c9
-rw-r--r--whatis.12
3 files changed, 6 insertions, 7 deletions
diff --git a/apropos.c b/apropos.c
index 95c92d03..0d97c82a 100644
--- a/apropos.c
+++ b/apropos.c
@@ -53,7 +53,7 @@ main(int argc, char *argv[])
else
++progname;
- whatis = 0 == strcmp(progname, "whatis");
+ whatis = 0 == strncmp(progname, "whatis", 6);
memset(&paths, 0, sizeof(struct manpaths));
memset(&opts, 0, sizeof(struct opts));
diff --git a/apropos_db.c b/apropos_db.c
index 5e473a6b..f1adf29c 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -599,10 +599,10 @@ termcomp(int argc, char *argv[], size_t *tt)
e = NULL;
*tt = 0;
- for (pos = 0; pos < argc; pos++) {
- sz = strlen(argv[pos]) + 16;
+ for (pos = argc - 1; pos >= 0; pos--) {
+ sz = strlen(argv[pos]) + 18;
buf = mandoc_realloc(buf, sz);
- strlcpy(buf, "~[[:<:]]", sz);
+ strlcpy(buf, "Nm~[[:<:]]", sz);
strlcat(buf, argv[pos], sz);
strlcat(buf, "[[:>:]]", sz);
if (NULL == (next = exprterm(buf, 0))) {
@@ -610,8 +610,7 @@ termcomp(int argc, char *argv[], size_t *tt)
exprfree(e);
return(NULL);
}
- if (NULL != e)
- e->next = next;
+ next->next = e;
e = next;
(*tt)++;
}
diff --git a/whatis.1 b/whatis.1
index 9415e265..8b320033 100644
--- a/whatis.1
+++ b/whatis.1
@@ -92,7 +92,7 @@ is identical to running
.Xr apropos 1
as follows:
.Pp
-.Dl $ apropos -- -i '~[[:<:]]term[[:>:]]'
+.Dl $ apropos -- -i 'Nm~[[:<:]]term[[:>:]]'
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev MANPATH