From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pAS9i56D023615 for ; Mon, 28 Nov 2011 04:44:06 -0500 (EST) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pAS9i537000253; Mon, 28 Nov 2011 04:44:05 -0500 (EST) Date: Mon, 28 Nov 2011 04:44:05 -0500 (EST) Message-Id: <201111280944.pAS9i537000253@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Tweak whatis(1): * Bugfix: Use all arguments, not just the last X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Tweak whatis(1): * Bugfix: Use all arguments, not just the last one. * Use 'Nm~' instead of 'Nm,Nd~' to match OpenBSD behaviour. * For the progname, accept '^whatis', not '^whatis$' to ease testing. ok kristaps@ Modified Files: -------------- mdocml: apropos.c apropos_db.c whatis.1 Revision Data ------------- Index: apropos_db.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.c,v retrieving revision 1.14 retrieving revision 1.15 diff -Lapropos_db.c -Lapropos_db.c -u -p -r1.14 -r1.15 --- apropos_db.c +++ apropos_db.c @@ -599,10 +599,10 @@ termcomp(int argc, char *argv[], size_t 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 exprfree(e); return(NULL); } - if (NULL != e) - e->next = next; + next->next = e; e = next; (*tt)++; } Index: apropos.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.c,v retrieving revision 1.20 retrieving revision 1.21 diff -Lapropos.c -Lapropos.c -u -p -r1.20 -r1.21 --- apropos.c +++ 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)); Index: whatis.1 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/whatis.1,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwhatis.1 -Lwhatis.1 -u -p -r1.1 -r1.2 --- whatis.1 +++ 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 -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv