Skip to content

Commit 5129f37

Browse files
committed
eliminate/document non-literal format strings
1 parent 18f6b42 commit 5129f37

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

games/larn/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: Makefile,v 1.20 2010/02/03 15:34:39 roy Exp $
1+
# $NetBSD: Makefile,v 1.21 2011/08/16 11:19:41 christos Exp $
22
# @(#)Makefile 5.12 (Berkeley) 5/30/93
33

44
# EXTRA
@@ -74,4 +74,7 @@ FILES=${DAT:S@^@${.CURDIR}/datfiles/@g}
7474
FILESDIR=/usr/share/games/larn
7575
.endif
7676

77+
COPTS.display.c += -Wno-format-nonliteral
78+
COPTS.monster.c += -Wno-format-nonliteral
79+
7780
.include <bsd.prog.mk>

games/larn/movem.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: movem.c,v 1.7 2009/08/12 08:04:05 dholland Exp $ */
1+
/* $NetBSD: movem.c,v 1.8 2011/08/16 11:19:41 christos Exp $ */
22

33
/*
44
* movem.c (move monster) Larn is copyrighted 1986 by Noah Morgan.
@@ -12,7 +12,7 @@
1212
*/
1313
#include <sys/cdefs.h>
1414
#ifndef lint
15-
__RCSID("$NetBSD: movem.c,v 1.7 2009/08/12 08:04:05 dholland Exp $");
15+
__RCSID("$NetBSD: movem.c,v 1.8 2011/08/16 11:19:41 christos Exp $");
1616
#endif /* not lint */
1717

1818
#include "header.h"
@@ -278,7 +278,7 @@ mmove(aa, bb, cc, dd)
278278
int aa, bb, cc, dd;
279279
{
280280
int tmp, i, flag;
281-
const char *who = NULL, *p;
281+
const char *who = NULL;
282282

283283
flag = 0; /* set to 1 if monster hit by arrow trap */
284284
if ((cc == playerx) && (dd == playery)) {
@@ -364,24 +364,22 @@ mmove(aa, bb, cc, dd)
364364
if (c[BLINDCOUNT])
365365
return; /* if blind don't show where monsters are */
366366
if (know[cc][dd] & 1) {
367-
p = 0;
368367
if (flag)
369368
cursors();
370369
switch (flag) {
371370
case 1:
372-
p = "\n%s hits the %s";
371+
lprintf("\n%s hits the %s", who, monster[tmp].name);
372+
beep();
373373
break;
374374
case 2:
375-
p = "\n%s hits and kills the %s";
375+
lprintf("\n%s hits and kills the %s",
376+
who, monster[tmp].name);
377+
beep();
376378
break;
377379
case 3:
378-
p = "\nThe %s%s gets teleported";
379-
who = "";
380-
break;
381-
};
382-
if (p) {
383-
lprintf(p, who, monster[tmp].name);
380+
lprintf("\nThe %s gets teleported", monster[tmp].name);
384381
beep();
382+
break;
385383
}
386384
}
387385
/*

0 commit comments

Comments
 (0)