Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/man use -Wno-format and revert "fixstring"



details:   https://anonhg.NetBSD.org/src/rev/22be2cec49e0
branches:  trunk
changeset: 788712:22be2cec49e0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jul 18 16:28:52 2013 +0000

description:
use -Wno-format and revert "fixstring"

diffstat:

 usr.bin/man/Makefile |   4 +++-
 usr.bin/man/man.c    |  23 ++++-------------------
 2 files changed, 7 insertions(+), 20 deletions(-)

diffs (76 lines):

diff -r 053daece8235 -r 22be2cec49e0 usr.bin/man/Makefile
--- a/usr.bin/man/Makefile      Thu Jul 18 16:01:41 2013 +0000
+++ b/usr.bin/man/Makefile      Thu Jul 18 16:28:52 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.12 2013/07/18 15:39:08 christos Exp $
+#      $NetBSD: Makefile,v 1.13 2013/07/18 16:28:52 christos Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 WARNS?=        6
@@ -7,6 +7,8 @@
 SRCS=  man.c manconf.c
 MAN=   man.1 man.conf.5
 
+COPTS.man.c += -Wno-format
+
 DPADD+=        ${LIBUTIL}
 LDADD+=        -lutil
 
diff -r 053daece8235 -r 22be2cec49e0 usr.bin/man/man.c
--- a/usr.bin/man/man.c Thu Jul 18 16:01:41 2013 +0000
+++ b/usr.bin/man/man.c Thu Jul 18 16:28:52 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: man.c,v 1.49 2013/07/18 16:01:25 christos Exp $        */
+/*     $NetBSD: man.c,v 1.50 2013/07/18 16:28:52 christos 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.49 2013/07/18 16:01:25 christos Exp $");
+__RCSID("$NetBSD: man.c,v 1.50 2013/07/18 16:28:52 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -464,21 +464,6 @@
        exit(cleanup());
 }
 
-static void
-fixstring(char *buf, size_t len, const char *fmt, const char *str)
-{
-       const char *ptr = strstr(fmt, "%s");
-       size_t l;
-       if (ptr == NULL) {
-               strlcpy(buf, fmt, len);
-               return;
-       }
-       l = (size_t)(ptr - fmt) + 1;
-       strlcpy(buf, fmt, MIN(l, len));
-       strlcat(buf, str, len);
-       strlcat(buf, ptr + 2, len);
-}
-
 static int
 manual_find_buildkeyword(char *escpage, const char *fmt,
        struct manstate *mp, glob_t *pg, size_t cnt)
@@ -498,7 +483,7 @@
                        continue;
 
                *p = '\0';
-               fixstring(buf, sizeof(buf), fmt, escpage);
+               (void)snprintf(buf, sizeof(buf), fmt, escpage, suffix->s);
                if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
                        if (!mp->where)
                                build_page(p + 1, &pg->gl_pathv[cnt], mp);
@@ -781,7 +766,7 @@
                exit(EXIT_FAILURE);
        }
        (void)snprintf(buf, sizeof(buf), "%s > %s", fmt, tpath);
-       fixstring(cmd, sizeof(cmd), buf, p);
+       (void)snprintf(cmd, sizeof(cmd), buf, p);
        (void)system(cmd);
        (void)close(fd);
        if ((*pathp = strdup(tpath)) == NULL) {



Home | Main Index | Thread Index | Old Index