Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man manual_find_buildkeyword() - now that we control...
details: https://anonhg.NetBSD.org/src/rev/d08f633df4c0
branches: trunk
changeset: 788763:d08f633df4c0
user: uwe <uwe%NetBSD.org@localhost>
date: Fri Jul 19 04:55:05 2013 +0000
description:
manual_find_buildkeyword() - now that we control the format string, we
may use asterisk precision specification instead of temporary
modifying the _build string itself.
diffstat:
usr.bin/man/man.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diffs (53 lines):
diff -r 908731828a73 -r d08f633df4c0 usr.bin/man/man.c
--- a/usr.bin/man/man.c Fri Jul 19 04:18:10 2013 +0000
+++ b/usr.bin/man/man.c Fri Jul 19 04:55:05 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.52 2013/07/19 04:18:10 uwe Exp $ */
+/* $NetBSD: man.c,v 1.53 2013/07/19 04:55:05 uwe Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.52 2013/07/19 04:18:10 uwe Exp $");
+__RCSID("$NetBSD: man.c,v 1.53 2013/07/19 04:55:05 uwe Exp $");
#endif
#endif /* not lint */
@@ -471,28 +471,26 @@
ENTRY *suffix;
int found;
char *p, buf[MAXPATHLEN];
+ int suflen;
found = 0;
/* Try the _build key words next. */
TAILQ_FOREACH(suffix, &mp->buildlist->entrylist, q) {
- for (p = suffix->s;
+ for (p = suffix->s, suflen = 0;
*p != '\0' && !isspace((unsigned char)*p);
++p)
- continue;
+ ++suflen;
if (*p == '\0')
continue;
- *p = '\0';
- (void)snprintf(buf, sizeof(buf), "%s%s%s",
- prefix, escpage, suffix->s);
+ (void)snprintf(buf, sizeof(buf), "%s%s%.*s",
+ prefix, escpage, suflen, suffix->s);
if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
if (!mp->where)
build_page(p + 1, &pg->gl_pathv[cnt], mp);
- *p = ' ';
found = 1;
break;
- }
- *p = ' ';
+ }
}
return found;
Home |
Main Index |
Thread Index |
Old Index