Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/man Fix manual_find_buildkeyword() to not use non-li...



details:   https://anonhg.NetBSD.org/src/rev/908731828a73
branches:  trunk
changeset: 788762:908731828a73
user:      uwe <uwe%NetBSD.org@localhost>
date:      Fri Jul 19 04:18:10 2013 +0000

description:
Fix manual_find_buildkeyword() to not use non-literal printf format.

diffstat:

 usr.bin/man/man.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 9c9af6233edf -r 908731828a73 usr.bin/man/man.c
--- a/usr.bin/man/man.c Fri Jul 19 04:17:02 2013 +0000
+++ b/usr.bin/man/man.c Fri Jul 19 04:18:10 2013 +0000
@@ -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 @@
 #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 @@
 }
 
 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 @@
                        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 @@
                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 @@
                                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;



Home | Main Index | Thread Index | Old Index