-/* $NetBSD: hack.shk.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */
+/* $NetBSD: hack.shk.c,v 1.14 2012/06/19 05:46:08 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.shk.c,v 1.9 2009/06/07 18:30:39 dholland Exp $");
+__RCSID("$NetBSD: hack.shk.c,v 1.14 2012/06/19 05:46:08 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
static struct bill_x *onbill(struct obj *);
static void pay(long, struct monst *);
static int dopayobj(struct bill_x *);
+static struct obj *bp_to_obj(struct bill_x *);
static int getprice(struct obj *);
static int realhunger(void);
#endif
void
obfree(struct obj *obj, struct obj *merge)
{
- free((char *) obj);
+ free(obj);
}
int
inshop(void) {
obj->unpaid = 0;
while ((obj = billobjs) != NULL) {
billobjs = obj->nobj;
- free((char *) obj);
+ free(obj);
}
ESHK(shopkeeper)->billct = 0;
}
*bp = bill[ESHK(shopkeeper)->billct];
}
}
- free((char *) obj);
+ free(obj);
}
static void
else
pline("Error in shopkeeper administration.");
}
- free((char *) obj);
+ free(obj);
}
return (1);
}
}
/* find obj on one of the lists */
-struct obj *
+static struct obj *
bp_to_obj(struct bill_x *bp)
{
struct obj *obj;
thisused = bp->price * uquan;
totused += thisused;
obj->quan = uquan; /* cheat doname */
- (void) sprintf(buf, "x - %s", doname(obj));
+ (void) snprintf(buf, sizeof(buf),
+ "x - %s", doname(obj));
obj->quan = oquan; /* restore value */
for (cnt = 0; buf[cnt]; cnt++);
while (cnt < 50)
buf[cnt++] = ' ';
- (void) sprintf(&buf[cnt], " %5ld zorkmids", thisused);
+ (void) snprintf(buf+cnt, sizeof(buf)-cnt,
+ " %5ld zorkmids", thisused);
if (page_line(buf))
goto quit;
}
}
- (void) sprintf(buf, "Total:%50ld zorkmids", totused);
+ (void) snprintf(buf, sizeof(buf), "Total:%50ld zorkmids", totused);
if (page_line("") || page_line(buf))
goto quit;
set_pager(1);
break;
case CHAIN_SYM:
pline("Strange ..., carrying a chain?");
+ /* FALLTHROUGH */
case BALL_SYM:
tmp = 10;
break;
/* He is digging in the shop. */
void
-shopdig(fall)
- int fall;
+shopdig(int fall)
{
if (!fall) {
if (u.utraptype == TT_PIT)