Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb fix legacy mode in pager filter. (don't u...
details: https://anonhg.NetBSD.org/src/rev/d21fcda3b764
branches: trunk
changeset: 785771:d21fcda3b764
user: christos <christos%NetBSD.org@localhost>
date: Fri Mar 29 20:46:07 2013 +0000
description:
fix legacy mode in pager filter. (don't ul format if we are not formatting).
diffstat:
usr.sbin/makemandb/apropos-utils.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diffs (72 lines):
diff -r e5d65e39e80e -r d21fcda3b764 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c Fri Mar 29 20:37:00 2013 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c Fri Mar 29 20:46:07 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apropos-utils.c,v 1.13 2013/03/29 20:37:00 christos Exp $ */
+/* $NetBSD: apropos-utils.c,v 1.14 2013/03/29 20:46:07 christos Exp $ */
/*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos-utils.c,v 1.13 2013/03/29 20:37:00 christos Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.14 2013/03/29 20:46:07 christos Exp $");
#include <sys/queue.h>
#include <sys/stat.h>
@@ -735,11 +735,14 @@
* underline a string, pager style.
*/
static char *
-ul_pager(const char *s)
+ul_pager(int ul, const char *s)
{
size_t len;
char *dst, *d;
+ if (!ul)
+ return estrdup(s);
+
// a -> _\ba
len = strlen(s) * 3 + 1;
@@ -767,7 +770,7 @@
char *psnippet;
const char *temp = snippet;
int count = 0;
- int i = 0;
+ int i = 0, did;
size_t sz = 0;
size_t psnippet_length;
@@ -792,6 +795,7 @@
* 2. The bytes after \002 need to be overstriked till we encounter \003.
* 3. To overstrike a byte 'A' we need to write 'A\bA'
*/
+ did = 0;
while (*snippet) {
sz = strcspn(snippet, "\002");
memcpy(&psnippet[i], snippet, sz);
@@ -804,6 +808,7 @@
if (*snippet == '\002')
snippet++;
while (*snippet && *snippet != '\003') {
+ did = 1;
psnippet[i++] = *snippet;
psnippet[i++] = '\b';
psnippet[i++] = *snippet++;
@@ -813,9 +818,9 @@
}
psnippet[i] = 0;
- char *ul_section = ul_pager(section);
- char *ul_name = ul_pager(name);
- char *ul_name_desc = ul_pager(name_desc);
+ char *ul_section = ul_pager(did, section);
+ char *ul_name = ul_pager(did, name);
+ char *ul_name_desc = ul_pager(did, name_desc);
(orig_data->callback)(orig_data->data, ul_section, ul_name,
ul_name_desc, psnippet, psnippet_length);
free(ul_section);
Home |
Main Index |
Thread Index |
Old Index