Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makemandb Set the snippet_length field of the callb...



details:   https://anonhg.NetBSD.org/src/rev/7b6f1ae0d664
branches:  trunk
changeset: 450437:7b6f1ae0d664
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Sun Apr 14 07:59:56 2019 +0000

description:
Set the snippet_length field of the callback_args

Because of this field not being set, apropos was failing to show snippet when piped to a pager
or when used with -p argument.

diffstat:

 usr.sbin/makemandb/apropos-utils.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 001bd7e43a02 -r 7b6f1ae0d664 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c        Sun Apr 14 07:57:51 2019 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c        Sun Apr 14 07:59:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apropos-utils.c,v 1.41 2019/03/07 22:08:59 christos Exp $      */
+/*     $NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav 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-utils.c,v 1.41 2019/03/07 22:08:59 christos Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav Exp $");
 
 #include <sys/queue.h>
 #include <sys/stat.h>
@@ -699,10 +699,13 @@
                name_temp = (const char *) sqlite3_column_text(stmt, 1);
                callback_args.name_desc = (const char *) sqlite3_column_text(stmt, 2);
                callback_args.machine = (const char *) sqlite3_column_text(stmt, 3);
-               if (!args->legacy)
+               if (!args->legacy) {
                        callback_args.snippet = (const char *) sqlite3_column_text(stmt, 4);
-               else
+                       callback_args.snippet_length = strlen(callback_args.snippet);
+               } else {
                        callback_args.snippet = "";
+                       callback_args.snippet_length = 1;
+               }
                if ((slash_ptr = strrchr(name_temp, '/')) != NULL)
                        name_temp = slash_ptr + 1;
                if (callback_args.machine && callback_args.machine[0]) {



Home | Main Index | Thread Index | Old Index