summaryrefslogtreecommitdiffstats
path: root/adventure/vocab.c
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1998-09-14 09:29:08 +0000
committerhubertf <hubertf@NetBSD.org>1998-09-14 09:29:08 +0000
commitab3c8a4ae26dfeb68ae67ed33f39558915aa0c69 (patch)
treeea4dbf5480a97439e70c036ff6cdeb6d5c773e6b /adventure/vocab.c
parentac89eb0e91b49c6c012b6ae0bf87686aea5ac5aa (diff)
downloadbsdgames-darwin-ab3c8a4ae26dfeb68ae67ed33f39558915aa0c69.tar.gz
bsdgames-darwin-ab3c8a4ae26dfeb68ae67ed33f39558915aa0c69.tar.zst
bsdgames-darwin-ab3c8a4ae26dfeb68ae67ed33f39558915aa0c69.zip
return error on errors (PR#6147 by Joseph Myers <jsm28@cam.ac.uk>)
Diffstat (limited to 'adventure/vocab.c')
-rw-r--r--adventure/vocab.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/adventure/vocab.c b/adventure/vocab.c
index 2685f8a8..5acc8b96 100644
--- a/adventure/vocab.c
+++ b/adventure/vocab.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vocab.c,v 1.8 1998/09/13 15:24:09 hubertf Exp $ */
+/* $NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: vocab.c,v 1.8 1998/09/13 15:24:09 hubertf Exp $");
+__RCSID("$NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $");
#endif
#endif /* not lint */
@@ -184,10 +184,8 @@ vocab(word, type, value) /* look up or store a word */
/* the word matched o.k. */
return (h->val);
default: /* looking up known word */
- if (h->val == 0) {
- printf("Unable to find %s in vocab\n", word);
- exit(0);
- }
+ if (h->val == 0)
+ errx(1,"Unable to find %s in vocab", word);
for (s = word, t = h->atab; *t ^ '=';)
if ((*s++ ^ '=') != *t++)
goto exitloop2;
@@ -198,10 +196,8 @@ vocab(word, type, value) /* look up or store a word */
}
exitloop2: /* hashed entry does not match */
- if (adr + 1 == hash || (adr == HTSIZE && hash == 0)) {
- printf("Hash table overflow\n");
- exit(0);
- }
+ if (adr + 1 == hash || (adr == HTSIZE && hash == 0))
+ errx(1,"Hash table overflow");
}
}