source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Tweak whatis(1): * Bugfix: Use all arguments, not just the last
Date: Mon, 28 Nov 2011 04:44:05 -0500 (EST)	[thread overview]
Message-ID: <201111280944.pAS9i537000253@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2011-11-28  9:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201111280944.pAS9i537000253@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).