Module Name: src
Committed By: uwe
Date: Fri Jul 19 04:18:10 UTC 2013
Modified Files:
src/usr.bin/man: man.c
Log Message:
Fix manual_find_buildkeyword() to not use non-literal printf format.
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/man/man.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.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.51 src/usr.bin/man/man.c:1.52
--- src/usr.bin/man/man.c:1.51 Thu Jul 18 16:33:31 2013
+++ src/usr.bin/man/man.c Fri Jul 19 04:18:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.51 2013/07/18 16:33:31 uwe Exp $ */
+/* $NetBSD: man.c,v 1.52 2013/07/19 04:18:10 uwe Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.51 2013/07/18 16:33:31 uwe Exp $");
+__RCSID("$NetBSD: man.c,v 1.52 2013/07/19 04:18:10 uwe Exp $");
#endif
#endif /* not lint */
@@ -465,7 +465,7 @@ main(int argc, char **argv)
}
static int
-manual_find_buildkeyword(char *escpage, const char *fmt,
+manual_find_buildkeyword(const char *prefix, const char *escpage,
struct manstate *mp, glob_t *pg, size_t cnt)
{
ENTRY *suffix;
@@ -483,7 +483,8 @@ manual_find_buildkeyword(char *escpage,
continue;
*p = '\0';
- (void)snprintf(buf, sizeof(buf), fmt, escpage, suffix->s);
+ (void)snprintf(buf, sizeof(buf), "%s%s%s",
+ prefix, escpage, suffix->s);
if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
if (!mp->where)
build_page(p + 1, &pg->gl_pathv[cnt], mp);
@@ -563,7 +564,7 @@ manual(char *page, struct manstate *mp,
for (cnt = pg->gl_pathc - pg->gl_matchc;
cnt < pg->gl_pathc; ++cnt)
{
- found = manual_find_buildkeyword(escpage, "%s%s",
+ found = manual_find_buildkeyword("", escpage,
mp, pg, cnt);
if (found) {
anyfound = 1;
@@ -658,7 +659,7 @@ manual(char *page, struct manstate *mp,
goto next;
/* Try the _build key words next. */
- found = manual_find_buildkeyword(escpage, "*/%s%s",
+ found = manual_find_buildkeyword("*/", escpage,
mp, pg, cnt);
if (found) {
next: anyfound = 1;