Module Name: src Committed By: tls Date: Sun Aug 10 06:59:45 UTC 2014
Modified Files: src/usr.sbin/makemandb [tls-earlyentropy]: apropos-utils.c makemandb.c Log Message: Rebase. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.15.4.1 src/usr.sbin/makemandb/apropos-utils.c cvs rdiff -u -r1.22 -r1.22.2.1 src/usr.sbin/makemandb/makemandb.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.15 src/usr.sbin/makemandb/apropos-utils.c:1.15.4.1 --- src/usr.sbin/makemandb/apropos-utils.c:1.15 Tue Apr 2 17:16:50 2013 +++ src/usr.sbin/makemandb/apropos-utils.c Sun Aug 10 06:59:45 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: apropos-utils.c,v 1.15 2013/04/02 17:16:50 christos Exp $ */ +/* $NetBSD: apropos-utils.c,v 1.15.4.1 2014/08/10 06:59:45 tls Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: apropos-utils.c,v 1.15 2013/04/02 17:16:50 christos Exp $"); +__RCSID("$NetBSD: apropos-utils.c,v 1.15.4.1 2014/08/10 06:59:45 tls Exp $"); #include <sys/queue.h> #include <sys/stat.h> @@ -704,9 +704,9 @@ callback_html(void *data, const char *se break; } } - qsnippet[++i] = 0; + qsnippet[i] = 0; (*callback)(orig_data->data, section, name, name_desc, - (const char *)qsnippet, qsnippet_length); + (const char *)qsnippet, strlen(qsnippet)); free(qsnippet); return 0; } Index: src/usr.sbin/makemandb/makemandb.c diff -u src/usr.sbin/makemandb/makemandb.c:1.22 src/usr.sbin/makemandb/makemandb.c:1.22.2.1 --- src/usr.sbin/makemandb/makemandb.c:1.22 Mon Feb 10 00:23:36 2014 +++ src/usr.sbin/makemandb/makemandb.c Sun Aug 10 06:59:45 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.22 2014/02/10 00:23:36 chs Exp $ */ +/* $NetBSD: makemandb.c,v 1.22.2.1 2014/08/10 06:59:45 tls Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: makemandb.c,v 1.22 2014/02/10 00:23:36 chs Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.22.2.1 2014/08/10 06:59:45 tls Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -124,6 +124,7 @@ static void update_db(sqlite3 *, struct __dead static void usage(void); static void optimize(sqlite3 *); static char *parse_escape(const char *); +static void replace_hyph(char *); static makemandb_flags mflags = { .verbosity = 1 }; typedef void (*pman_nf)(const struct man_node *n, mandb_rec *); @@ -978,6 +979,7 @@ pmdoc_Nd(const struct mdoc_node *n, mand */ char *buf = NULL; char *temp; + char *nd_text; if (n == NULL) return; @@ -995,7 +997,10 @@ pmdoc_Nd(const struct mdoc_node *n, mand free(buf); free(temp); } else { - concat(&rec->name_desc, n->string); + nd_text = estrdup(n->string); + replace_hyph(nd_text); + concat(&rec->name_desc, nd_text); + free(nd_text); } rec->xr_found = 0; } else if (mdocs[n->tok] == pmdoc_Xr) { @@ -1713,7 +1718,7 @@ insert_into_db(sqlite3 *db, mandb_rec *r rc = sqlite3_step(stmt); sqlite3_finalize(stmt); - if (rc == SQLITE_CONSTRAINT) { + if (rc == SQLITE_CONSTRAINT_UNIQUE) { /* The *most* probable reason for reaching here is that * the UNIQUE contraint on the file column of the mandb_meta * table was violated. @@ -2009,6 +2014,10 @@ replace_hyph(char *str) char *iter = str; while ((iter = strchr(iter, ASCII_HYPH)) != NULL) *iter = '-'; + + iter = str; + while ((iter = strchr(iter, ASCII_NBRSP)) != NULL) + *iter = '-'; } static char *