Module Name: src Committed By: christos Date: Thu Jul 18 16:28:52 UTC 2013
Modified Files: src/usr.bin/man: Makefile man.c Log Message: use -Wno-format and revert "fixstring" To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/man/Makefile cvs rdiff -u -r1.49 -r1.50 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/Makefile diff -u src/usr.bin/man/Makefile:1.12 src/usr.bin/man/Makefile:1.13 --- src/usr.bin/man/Makefile:1.12 Thu Jul 18 11:39:08 2013 +++ src/usr.bin/man/Makefile Thu Jul 18 12:28:52 2013 @@ -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 @@ PROG= man SRCS= man.c manconf.c MAN= man.1 man.conf.5 +COPTS.man.c += -Wno-format + DPADD+= ${LIBUTIL} LDADD+= -lutil Index: src/usr.bin/man/man.c diff -u src/usr.bin/man/man.c:1.49 src/usr.bin/man/man.c:1.50 --- src/usr.bin/man/man.c:1.49 Thu Jul 18 12:01:25 2013 +++ src/usr.bin/man/man.c Thu Jul 18 12:28:52 2013 @@ -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 @@ __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.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 @@ main(int argc, char **argv) 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 @@ manual_find_buildkeyword(char *escpage, 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 @@ build_page(char *fmt, char **pathp, stru 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) {