diff options
-rw-r--r-- | apropos.c | 2 | ||||
-rw-r--r-- | apropos_db.c | 9 | ||||
-rw-r--r-- | whatis.1 | 2 |
3 files changed, 6 insertions, 7 deletions
@@ -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)++; } @@ -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 |