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/object.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/object.c')
-rw-r--r-- | larn/object.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/larn/object.c b/larn/object.c index 59df0215..43889b8b 100644 --- a/larn/object.c +++ b/larn/object.c @@ -1,10 +1,10 @@ -/* $NetBSD: object.c,v 1.10 2001/02/05 00:57:34 christos Exp $ */ +/* $NetBSD: object.c,v 1.11 2008/01/28 03:39:31 dholland Exp $ */ /* object.c Larn is copyrighted 1986 by Noah Morgan. */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: object.c,v 1.10 2001/02/05 00:57:34 christos Exp $"); +__RCSID("$NetBSD: object.c,v 1.11 2008/01/28 03:39:31 dholland Exp $"); #endif /* not lint */ #include "header.h" #include "extern.h" @@ -517,9 +517,9 @@ finditem(itm) default: if (tmp > 0) - lprintf("+ %d", (long) tmp); + lprintf("+ %ld", (long) tmp); else if (tmp < 0) - lprintf(" %d", (long) tmp); + lprintf(" %ld", (long) tmp); } lprcat("\nDo you want to (t) take it"); iopts(); @@ -571,7 +571,7 @@ ostairs(dir) lprcat("\nI hope you feel better. Showing anger rids you of frustration."); else { k = rnd((level + 1) << 1); - lprintf("\nYou hurt your foot dumb dumb! You suffer %d hit points", (long) k); + lprintf("\nYou hurt your foot dumb dumb! You suffer %ld hit points", (long) k); lastnum = 276; losehp(k); bottomline(); @@ -996,9 +996,9 @@ read_scroll(typ) case 7: gltime += (i = rnd(1000) - 850); /* time warp */ if (i >= 0) - lprintf("\nYou went forward in time by %d mobuls", (long) ((i + 99) / 100)); + lprintf("\nYou went forward in time by %ld mobuls", (long) ((i + 99) / 100)); else - lprintf("\nYou went backward in time by %d mobuls", (long) (-(i + 99) / 100)); + lprintf("\nYou went backward in time by %ld mobuls", (long) (-(i + 99) / 100)); adjusttime((long) i); /* adjust time for time warping */ return; @@ -1122,7 +1122,7 @@ opit() lprcat("\nYou fell into a pit! Your fall is cushioned by an unknown force\n"); } else { i = rnd(level * 3 + 3); - lprintf("\nYou fell into a pit! You suffer %d hit points damage", (long) i); + lprintf("\nYou fell into a pit! You suffer %ld hit points damage", (long) i); lastnum = 261; /* if he dies scoreboard * will say so */ } @@ -1265,7 +1265,7 @@ ogold(arg) i *= 1000; else if (arg == ODGOLD) i *= 10; - lprintf("\nIt is worth %d!", (long) i); + lprintf("\nIt is worth %ld!", (long) i); c[GOLD] += i; bottomgold(); item[playerx][playery] = know[playerx][playery] = 0; /* destroy gold */ @@ -1314,7 +1314,7 @@ ohome() died(269); } lprcat("\nThe diagnosis is confirmed as dianthroritis. He guesses that\n"); - lprintf("your daughter has only %d mobuls left in this world. It's up to you,\n", (long) ((TIMELIMIT - gltime + 99) / 100)); + lprintf("your daughter has only %ld mobuls left in this world. It's up to you,\n", (long) ((TIMELIMIT - gltime + 99) / 100)); lprintf("%s, to find the only hope for your daughter, the very rare\n", logname); lprcat("potion of cure dianthroritis. It is rumored that only deep in the\n"); lprcat("depths of the caves can this potion be found.\n\n\n"); |