Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makemandb Replace non-breaking space with hyphen, a...



details:   https://anonhg.NetBSD.org/src/rev/fb78bf76ee98
branches:  trunk
changeset: 796210:fb78bf76ee98
user:      wiz <wiz%NetBSD.org@localhost>
date:      Sat May 24 21:01:58 2014 +0000

description:
Replace non-breaking space with hyphen, and call hyphen replacement
from one more place.
Improves 'man -k midi' output.

>From Abhinav Upadhyay.

diffstat:

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

diffs (57 lines):

diff -r 101a9ba7bdc0 -r fb78bf76ee98 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Sat May 24 18:41:46 2014 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Sat May 24 21:01:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makemandb.c,v 1.22 2014/02/10 00:23:36 chs Exp $       */
+/*     $NetBSD: makemandb.c,v 1.23 2014/05/24 21:01:58 wiz Exp $       */
 /*
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -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.23 2014/05/24 21:01:58 wiz Exp $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -124,6 +124,7 @@
 __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 @@
         */
        char *buf = NULL;
        char *temp;
+       char *nd_text;
 
        if (n == NULL)
                return;
@@ -995,7 +997,10 @@
                        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) {
@@ -2009,6 +2014,10 @@
        char *iter = str;
        while ((iter = strchr(iter, ASCII_HYPH)) != NULL)
                *iter = '-';
+
+       iter = str;
+       while ((iter = strchr(iter, ASCII_NBRSP)) != NULL)
+               *iter = '-';
 }
 
 static char *



Home | Main Index | Thread Index | Old Index