source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Tweak whatis(1): * Bugfix: Use all arguments, not just the last
@ 2011-11-28  9:44 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2011-11-28  9:44 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-28  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28  9:44 mdocml: Tweak whatis(1): * Bugfix: Use all arguments, not just the last schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).