-/* $NetBSD: hack.invent.c,v 1.14 2009/08/12 07:28:40 dholland Exp $ */
+/* $NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.invent.c,v 1.14 2009/08/12 07:28:40 dholland Exp $");
+__RCSID("$NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $");
#endif /* not lint */
#include <assert.h>
static int lastinvnr = 51; /* 0 ... 51 */
static char *xprname(struct obj *, char);
-static void doinv(char *);
+static void doinv(const char *);
static int merged(struct obj *, struct obj *, int);
static void
}
gtmp->ngold = gold->ngold;
}
- free((char *) gold);
+ free(gold);
}
void
for (ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap);
ttmp->ntrap = trap->ntrap;
}
- free((char *) trap);
+ free(trap);
}
struct wseg *m_atseg;
continue;
/* he typed a letter (not a space) to more() */
} else if (ilet == '*') {
- doinv((char *) 0);
+ doinv(NULL);
if (!(ilet = morc))
continue;
/* ... */
if (ckfn && !(*ckfn) (otmp))
continue;
if (!allflag) {
- pline(xprname(otmp, ilet));
+ pline("%s", xprname(otmp, ilet));
addtopl(" [nyaq]? ");
sym = readchar();
} else
switch (sym) {
case 'a':
allflag = 1;
+ /* FALLTHROUGH */
case 'y':
cnt += (*fn) (otmp);
if (--max == 0)
goto ret;
+ break;
case 'n':
default:
break;
void
prinv(struct obj *obj)
{
- pline(xprname(obj, obj_to_let(obj)));
+ pline("%s", xprname(obj, obj_to_let(obj)));
}
static char *
int
ddoinv(void)
{
- doinv((char *) 0);
+ doinv(NULL);
return (0);
}
/* called with 0 or "": all objects in inventory */
/* otherwise: all objects with (serial) letter in lets */
static void
-doinv(char *lets)
+doinv(const char *lets)
{
struct obj *otmp;
char ilet;
pline("Not carrying anything.");
return;
}
- cornline(0, (char *) 0);
+ cornline(0, NULL);
ilet = 'a';
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (flags.invlet_constant)
}
if (ct == 1 && !gold) {
pline("You %s here %s.", verb, doname(otmp0));
- cornline(3, (char *) 0);
+ cornline(3, NULL);
}
if (ct > 1)
- cornline(2, (char *) 0);
+ cornline(2, NULL);
return (!!Blind);
}