Module Name: src
Committed By: abhinav
Date: Sun Apr 14 07:59:56 UTC 2019
Modified Files:
src/usr.sbin/makemandb: apropos-utils.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makemandb/apropos-utils.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/makemandb/apropos-utils.c
diff -u src/usr.sbin/makemandb/apropos-utils.c:1.41 src/usr.sbin/makemandb/apropos-utils.c:1.42
--- src/usr.sbin/makemandb/apropos-utils.c:1.41 Thu Mar 7 22:08:59 2019
+++ src/usr.sbin/makemandb/apropos-utils.c Sun Apr 14 07:59:56 2019
@@ -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 <[email protected]>
* 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 @@ execute_search_query(sqlite3 *db, char *
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]) {