Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb if we only asked for stopwords, use the o...



details:   https://anonhg.NetBSD.org/src/rev/ae57899fcd41
branches:  trunk
changeset: 342406:ae57899fcd41
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Dec 20 19:45:29 2015 +0000

description:
if we only asked for stopwords, use the original query.

diffstat:

 usr.sbin/makemandb/apropos.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r fc6d82d66f8d -r ae57899fcd41 usr.sbin/makemandb/apropos.c
--- a/usr.sbin/makemandb/apropos.c      Sun Dec 20 16:24:45 2015 +0000
+++ b/usr.sbin/makemandb/apropos.c      Sun Dec 20 19:45:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apropos.c,v 1.16 2013/04/02 17:16:50 christos Exp $    */
+/*     $NetBSD: apropos.c,v 1.17 2015/12/20 19:45:29 christos Exp $    */
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos.c,v 1.16 2013/04/02 17:16:50 christos Exp $");
+__RCSID("$NetBSD: apropos.c,v 1.17 2015/12/20 19:45:29 christos Exp $");
 
 #include <err.h>
 #include <search.h>
@@ -188,11 +188,15 @@
                concat(&str, *argv++);
        /* Eliminate any stopwords from the query */
        query = remove_stopwords(lower(str));
-       free(str);
 
-       /* if any error occured in remove_stopwords, exit */
+       /*
+        * If the query consisted only of stopwords and we removed all of
+        * them, use the original query.
+        */
        if (query == NULL)
-               errx(EXIT_FAILURE, "Try using more relevant keywords");
+               query = str;
+       else
+               free(str);
 
        if ((db = init_db(MANDB_READONLY, MANCONF)) == NULL)
                exit(EXIT_FAILURE);



Home | Main Index | Thread Index | Old Index