diff options
author | dholland <dholland@NetBSD.org> | 2008-01-28 03:39:30 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2008-01-28 03:39:30 +0000 |
commit | 32e97ccd7409faa7c0028480f30414a8aa0d1421 (patch) | |
tree | b5c3684808fd1ce9002cdf547760ab4e3eedd2ef /larn/moreobj.c | |
parent | 4c39d3d5d3a9a029eecd375d4c55d91ed234cc9c (diff) | |
download | bsdgames-darwin-32e97ccd7409faa7c0028480f30414a8aa0d1421.tar.gz bsdgames-darwin-32e97ccd7409faa7c0028480f30414a8aa0d1421.tar.zst bsdgames-darwin-32e97ccd7409faa7c0028480f30414a8aa0d1421.zip |
Add gcc printf format checking, and fix the abundant problems this revealed.
(It appears that someone sometime thought that you use %d to print a long.)
Diffstat (limited to 'larn/moreobj.c')
-rw-r--r-- | larn/moreobj.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/larn/moreobj.c b/larn/moreobj.c index ab236281..b9ace546 100644 --- a/larn/moreobj.c +++ b/larn/moreobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: moreobj.c,v 1.6 2004/01/27 20:30:30 jsm Exp $ */ +/* $NetBSD: moreobj.c,v 1.7 2008/01/28 03:39:31 dholland Exp $ */ /* * moreobj.c Larn is copyrighted 1986 by Noah Morgan. @@ -9,7 +9,7 @@ */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: moreobj.c,v 1.6 2004/01/27 20:30:30 jsm Exp $"); +__RCSID("$NetBSD: moreobj.c,v 1.7 2008/01/28 03:39:31 dholland Exp $"); #endif /* not lint */ #include <stdlib.h> #include <unistd.h> @@ -247,7 +247,7 @@ ochest() beep(); i = rnd(10); lastnum = 281; /* in case he dies */ - lprintf("\nYou suffer %d hit points damage!", (long) i); + lprintf("\nYou suffer %ld hit points damage!", (long) i); checkloss(i); switch (rnd(10)) { /* see if he gets a * curse */ @@ -347,7 +347,7 @@ ofountain() lprcat("wash yourself"); if (rnd(100) < 11) { x = rnd((level << 2) + 2); - lprintf("\nOh no! The water was foul! You suffer %d hit points!", (long) x); + lprintf("\nOh no! The water was foul! You suffer %ld hit points!", (long) x); lastnum = 273; losehp(x); bottomline(); @@ -424,14 +424,14 @@ fntchange(how) case 7: j = rnd(level + 1); if (how < 0) { - lprintf("You lose %d hit point", (long) j); + lprintf("You lose %ld hit point", (long) j); if (j > 1) lprcat("s!"); else lprc('!'); losemhp((int) j); } else { - lprintf("You gain %d hit point", (long) j); + lprintf("You gain %ld hit point", (long) j); if (j > 1) lprcat("s!"); else @@ -444,14 +444,14 @@ fntchange(how) case 8: j = rnd(level + 1); if (how > 0) { - lprintf("You just gained %d spell", (long) j); + lprintf("You just gained %ld spell", (long) j); raisemspells((int) j); if (j > 1) lprcat("s!"); else lprc('!'); } else { - lprintf("You just lost %d spell", (long) j); + lprintf("You just lost %ld spell", (long) j); losemspells((int) j); if (j > 1) lprcat("s!"); @@ -464,14 +464,14 @@ fntchange(how) case 9: j = 5 * rnd((level + 1) * (level + 1)); if (how < 0) { - lprintf("You just lost %d experience point", (long) j); + lprintf("You just lost %ld experience point", (long) j); if (j > 1) lprcat("s!"); else lprc('!'); loseexperience((long) j); } else { - lprintf("You just gained %d experience point", (long) j); + lprintf("You just gained %ld experience point", (long) j); if (j > 1) lprcat("s!"); else |