Module Name:    src
Committed By:   joerg
Date:           Wed Feb 29 23:37:07 UTC 2012

Modified Files:
        src/usr.bin/error: error.h touch.c

Log Message:
Don't use non-literal format strings. Split it up depending on the
number of arguments used.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/error/error.h
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/error/touch.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/error/error.h
diff -u src/usr.bin/error/error.h:1.18 src/usr.bin/error/error.h:1.19
--- src/usr.bin/error/error.h:1.18	Wed Aug 17 13:11:22 2011
+++ src/usr.bin/error/error.h	Wed Feb 29 23:37:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: error.h,v 1.18 2011/08/17 13:11:22 christos Exp $	*/
+/*	$NetBSD: error.h,v 1.19 2012/02/29 23:37:07 joerg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -114,7 +114,7 @@ extern const char *suffixlist;
 
 extern boolean query;
 extern boolean terse;
-int inquire(const char *, ...);	/* inquire for yes/no */
+int inquire(const char *, ...) __printflike(1, 2);	/* inquire for yes/no */
 
 /*
  * codes for inquire() to return

Index: src/usr.bin/error/touch.c
diff -u src/usr.bin/error/touch.c:1.26 src/usr.bin/error/touch.c:1.27
--- src/usr.bin/error/touch.c:1.26	Tue May 24 12:24:22 2011
+++ src/usr.bin/error/touch.c	Wed Feb 29 23:37:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.26 2011/05/24 12:24:22 joerg Exp $	*/
+/*	$NetBSD: touch.c,v 1.27 2012/02/29 23:37:07 joerg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)touch.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.26 2011/05/24 12:24:22 joerg Exp $");
+__RCSID("$NetBSD: touch.c,v 1.27 2012/02/29 23:37:07 joerg Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -388,10 +388,13 @@ settotouch(const char *name)
 	int dest = TOSTDOUT;
 
 	if (query) {
-		switch (inquire(terse
-			? "Touch? "
-			: "Do you want to touch file \"%s\"? ",
-			name)) {
+		int reply;
+		if (terse)
+			reply = inquire("Touch? ");
+		else
+			reply = inquire("Do you want to touch file \"%s\"? ",
+			    name);
+		switch (reply) {
 		case Q_NO:
 		case Q_no:
 		case Q_error:

Reply via email to