return error on errors (PR#6147 by Joseph Myers <jsm28@cam.ac.uk>)

This commit is contained in:
hubertf 1998-09-14 09:29:08 +00:00
parent 4e4187282a
commit 006cc8ac96
4 changed files with 21 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.9 1998/09/13 15:24:09 hubertf Exp $ */
/* $NetBSD: io.c,v 1.10 1998/09/14 09:29:08 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: io.c,v 1.9 1998/09/13 15:24:09 hubertf Exp $");
__RCSID("$NetBSD: io.c,v 1.10 1998/09/14 09:29:08 hubertf Exp $");
#endif
#endif /* not lint */
@ -297,10 +297,8 @@ rdesc(sect) /* read description-format msgs */
ptext[oldloc].txtlen = maystart - seekstart;
break;
case 6:/* random messages */
if (oldloc > RTXSIZ) {
printf("Too many random msgs\n");
exit(0);
}
if (oldloc > RTXSIZ)
errx(1,"Too many random msgs");
rtext[oldloc].seekadr = seekhere;
rtext[oldloc].txtlen = maystart - seekstart;
break;
@ -310,16 +308,13 @@ rdesc(sect) /* read description-format msgs */
cval[clsses++] = oldloc;
break;
case 12: /* magic messages */
if (oldloc > MAGSIZ) {
printf("Too many magic msgs\n");
exit(0);
}
if (oldloc > MAGSIZ)
errx(1,"Too many magic msgs");
mtext[oldloc].seekadr = seekhere;
mtext[oldloc].txtlen = maystart - seekstart;
break;
default:
printf("rdesc called with bad section\n");
exit(0);
errx(1,"rdesc called with bad section");
}
seekhere += maystart - seekstart;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.11 1998/09/13 15:21:37 hubertf Exp $ */
/* $NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
#else
__RCSID("$NetBSD: main.c,v 1.11 1998/09/13 15:21:37 hubertf Exp $");
__RCSID("$NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $");
#endif
#endif /* not lint */
@ -90,10 +90,10 @@ main(argc, argv)
unlink(argv[1]); /* Don't re-use the save */
goto l8; /* Get where we're going */
case 1: /* Couldn't open it */
exit(0); /* So give up */
errx(1,"can't open file"); /* So give up */
case 2: /* Oops -- file was altered */
rspeak(202); /* You dissolve */
exit(0); /* File could be non-adventure */
exit(1); /* File could be non-adventure */
} /* So don't unlink it. */
}
startup(); /* prepare for a user */
@ -277,8 +277,7 @@ l2630: i = vocab(wd1, -1, 0);
case 4:
goto l2010;
default:
printf("Error 22\n");
exit(0);
bug(22);
}
l8:

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.7 1998/09/13 15:21:37 hubertf Exp $ */
/* $NetBSD: subr.c,v 1.8 1998/09/14 09:29:08 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: subr.c,v 1.7 1998/09/13 15:21:37 hubertf Exp $");
__RCSID("$NetBSD: subr.c,v 1.8 1998/09/14 09:29:08 hubertf Exp $");
#endif
#endif /* not lint */
@ -500,7 +500,7 @@ bug(n)
int n;
{
printf("Please tell jim@rand.org that fatal bug %d happened.\n", n);
exit(0);
exit(1);
}

View File

@ -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");
}
}