Module Name: src Committed By: christos Date: Thu Mar 24 17:28:03 UTC 2016
Modified Files: src/usr.sbin/makemandb: makemandb.c Log Message: PR/51006: Abhinav Upadhyay: makemandb(8) should parse escape sequences in the NAME section To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 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/makemandb.c diff -u src/usr.sbin/makemandb/makemandb.c:1.31 src/usr.sbin/makemandb/makemandb.c:1.32 --- src/usr.sbin/makemandb/makemandb.c:1.31 Wed Jan 27 22:32:29 2016 +++ src/usr.sbin/makemandb/makemandb.c Thu Mar 24 13:28:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.31 2016/01/28 03:32:29 christos Exp $ */ +/* $NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv> @@ -17,13 +17,12 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: makemandb.c,v 1.31 2016/01/28 03:32:29 christos Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $"); #include <sys/stat.h> #include <sys/types.h> #include <assert.h> -#include <ctype.h> #include <dirent.h> #include <err.h> #include <archive.h> @@ -39,7 +38,6 @@ __RCSID("$NetBSD: makemandb.c,v 1.31 201 #include "dist/man.h" #include "dist/mandoc.h" #include "dist/mdoc.h" -#include "sqlite3.h" #define BUFLEN 1024 #define MDOC 0 //If the page is of mdoc(7) type @@ -1013,7 +1011,9 @@ pmdoc_Nm(const struct mdoc_node *n, mand for (n = n->child; n; n = n->next) { if (n->type == MDOC_TEXT) { - concat(&rec->name, n->string); + char *escaped_name = parse_escape(n->string); + concat(&rec->name, escaped_name); + free(escaped_name); } } } @@ -1045,8 +1045,7 @@ pmdoc_Nd(const struct mdoc_node *n, mand concat(&rec->name_desc, buf); free(buf); } else { - nd_text = estrdup(n->string); - replace_hyph(nd_text); + nd_text = parse_escape(n->string); concat(&rec->name_desc, nd_text); free(nd_text); } @@ -1329,7 +1328,7 @@ pman_sh(const struct man_node *n, mandb_ }; const struct man_node *head; char *name_desc; - int sz; + size_t sz; size_t i; if ((head = n->parent->head) == NULL || (head = head->child) == NULL ||