summaryrefslogtreecommitdiff
path: root/games/hack/hack.pri.c
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2003-05-07 09:48:58 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2003-05-07 09:48:58 +0000
commitc4fc169dda87c72986c6289cda73af58d9525ad0 (patch)
treec1f83121a66300e511baa11937369bd3650633b8 /games/hack/hack.pri.c
parentcec4fba2d68884e9da4662a55153a523a76eb5f2 (diff)
Major strings rework. Ok pjanzen@
Diffstat (limited to 'games/hack/hack.pri.c')
-rw-r--r--games/hack/hack.pri.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/games/hack/hack.pri.c b/games/hack/hack.pri.c
index b2a432e8941..998bd3279a8 100644
--- a/games/hack/hack.pri.c
+++ b/games/hack/hack.pri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.pri.c,v 1.6 2003/04/06 18:50:37 deraadt Exp $ */
+/* $OpenBSD: hack.pri.c,v 1.7 2003/05/07 09:48:57 tdeval Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -62,7 +62,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: hack.pri.c,v 1.6 2003/04/06 18:50:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: hack.pri.c,v 1.7 2003/05/07 09:48:57 tdeval Exp $";
#endif /* not lint */
#include "hack.h"
@@ -655,7 +655,7 @@ register int lth;
bot()
{
-register char *ob = oldbot, *nb = newbot;
+register char *ob = oldbot, *nb = newbot, *bp;
register int i;
extern char *eos();
if(flags.botlx) *ob = 0;
@@ -672,18 +672,28 @@ extern char *eos();
if(u.ustr>18) {
if(u.ustr>117)
(void) strlcat(newbot,"18/**",sizeof newbot);
- else
- (void) sprintf(eos(newbot), "18/%02d",u.ustr-18);
- } else
- (void) sprintf(eos(newbot), "%-2d ",u.ustr);
+ else {
+ bp = eos(newbot);
+ (void) snprintf(bp, newbot + sizeof newbot - bp,
+ "18/%02d",u.ustr-18);
+ }
+ } else {
+ bp = eos(newbot);
+ (void) snprintf(bp, newbot + sizeof newbot - bp, "%-2d ",u.ustr);
+ }
+ bp = eos(newbot);
#ifdef EXP_ON_BOTL
- (void) sprintf(eos(newbot), " Exp %2d/%-5lu ", u.ulevel,u.uexp);
+ (void) snprintf(bp, newbot + sizeof newbot - bp,
+ " Exp %2d/%-5lu ", u.ulevel,u.uexp);
#else
- (void) sprintf(eos(newbot), " Exp %2u ", u.ulevel);
+ (void) snprintf(bp, newbot + sizeof newbot - bp,
+ " Exp %2u ", u.ulevel);
#endif /* EXP_ON_BOTL */
(void) strlcat(newbot, hu_stat[u.uhs], sizeof newbot);
- if(flags.time)
- (void) sprintf(eos(newbot), " %ld", moves);
+ if(flags.time) {
+ bp = eos(newbot);
+ (void) snprintf(bp, newbot + sizeof newbot - bp, " %ld", moves);
+ }
if(strlen(newbot) >= COLNO) {
register char *bp0, *bp1;
bp0 = bp1 = newbot;