From f6138c99bc04c12506713ae9badd0552ddfc22e5 Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 10 Jul 2000 10:19:25 +0000 Subject: [PATCH] printf() pedant - do not pass variable alone, use %s. idea from openbsd. after looking at freebsd commit msgs from kris@freebsd. --- hack/hack.tty.c | 6 +++--- monop/getinp.c | 8 ++++---- rogue/message.c | 6 +++--- trek/phaser.c | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hack/hack.tty.c b/hack/hack.tty.c index 5259258e..f979e903 100644 --- a/hack/hack.tty.c +++ b/hack/hack.tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.tty.c,v 1.6 1997/10/19 16:59:17 christos Exp $ */ +/* $NetBSD: hack.tty.c,v 1.7 2000/07/10 10:19:25 itojun Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: hack.tty.c,v 1.6 1997/10/19 16:59:17 christos Exp $"); +__RCSID("$NetBSD: hack.tty.c,v 1.7 2000/07/10 10:19:25 itojun Exp $"); #endif #endif /* not lint */ @@ -98,7 +98,7 @@ settty(s) clear_screen(); end_screen(); if (s) - printf(s); + printf("%s", s); (void) fflush(stdout); if (tcsetattr(0, TCSADRAIN, &inittyb) < 0) perror("Hack (settty)"); diff --git a/monop/getinp.c b/monop/getinp.c index 8976ba2f..66457448 100644 --- a/monop/getinp.c +++ b/monop/getinp.c @@ -1,4 +1,4 @@ -/* $NetBSD: getinp.c,v 1.8 1999/09/08 21:17:51 jsm Exp $ */ +/* $NetBSD: getinp.c,v 1.9 2000/07/10 10:19:26 itojun Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getinp.c,v 1.8 1999/09/08 21:17:51 jsm Exp $"); +__RCSID("$NetBSD: getinp.c,v 1.9 2000/07/10 10:19:26 itojun Exp $"); #endif #endif /* not lint */ @@ -63,7 +63,7 @@ getinp(prompt, list) for (;;) { inter: - printf(prompt); + printf("%s", prompt); for (sp = buf; (c=getchar()) != '\n'; ) { *sp = c; if (c == -1) /* check for interupted system call */ @@ -84,7 +84,7 @@ inter: printf(""); } else - printf(list[i]); + printf("%s", list[i]); if (list[i+1]) printf(", "); else diff --git a/rogue/message.c b/rogue/message.c index 22bf2a4c..17af007c 100644 --- a/rogue/message.c +++ b/rogue/message.c @@ -1,4 +1,4 @@ -/* $NetBSD: message.c,v 1.7 1998/11/10 13:01:32 hubertf Exp $ */ +/* $NetBSD: message.c,v 1.8 2000/07/10 10:19:27 itojun Exp $ */ /* * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: message.c,v 1.7 1998/11/10 13:01:32 hubertf Exp $"); +__RCSID("$NetBSD: message.c,v 1.8 2000/07/10 10:19:27 itojun Exp $"); #endif #endif /* not lint */ @@ -209,7 +209,7 @@ rgetchar() break; #ifdef UNIX_BSD4_2 case '\032': - printf(CL); + printf("%s", CL); fflush(stdout); tstp(); break; diff --git a/trek/phaser.c b/trek/phaser.c index 96ef5372..8fe19250 100644 --- a/trek/phaser.c +++ b/trek/phaser.c @@ -1,4 +1,4 @@ -/* $NetBSD: phaser.c,v 1.7 1999/09/08 21:45:33 jsm Exp $ */ +/* $NetBSD: phaser.c,v 1.8 2000/07/10 10:19:27 itojun Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: phaser.c,v 1.7 1999/09/08 21:45:33 jsm Exp $"); +__RCSID("$NetBSD: phaser.c,v 1.8 2000/07/10 10:19:27 itojun Exp $"); #endif #endif /* not lint */ @@ -140,13 +140,13 @@ phaser(v) { if (damaged(COMPUTER)) { - printf(Device[COMPUTER].name); + printf("%s", Device[COMPUTER].name); manual++; } else if (damaged(SRSCAN)) { - printf(Device[SRSCAN].name); + printf("%s", Device[SRSCAN].name); manual++; } if (manual) -- 2.47.1