Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makemandb PR/51006: Abhinav Upadhyay: makemandb(8) ...



details:   https://anonhg.NetBSD.org/src/rev/141050fd40e0
branches:  trunk
changeset: 814510:141050fd40e0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 24 17:28:03 2016 +0000

description:
PR/51006: Abhinav Upadhyay: makemandb(8) should parse escape sequences
in the NAME section

diffstat:

 usr.sbin/makemandb/makemandb.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r 186cecc2ae75 -r 141050fd40e0 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Thu Mar 24 16:07:13 2016 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Thu Mar 24 17:28:03 2016 +0000
@@ -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.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -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 @@
 #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 @@
 
        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 @@
                        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 @@
        };
        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 ||



Home | Main Index | Thread Index | Old Index