diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-11-29 19:45:12 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-11-29 19:45:12 +0000 |
commit | a61d4a2bb98bef1baf926d04dc03a23753761164 (patch) | |
tree | 0b3a922f43a487bfb42046f533c088509a1f33ce | |
parent | b84b006f18895b26889fc960039cd3d71541556f (diff) |
Minor changes from NetBSD
-rw-r--r-- | games/adventure/io.c | 19 | ||||
-rw-r--r-- | games/adventure/main.c | 9 | ||||
-rw-r--r-- | games/adventure/vocab.c | 16 | ||||
-rw-r--r-- | games/backgammon/common_source/subs.c | 6 | ||||
-rw-r--r-- | games/monop/execute.c | 6 | ||||
-rw-r--r-- | games/trek/dumpgame.c | 6 |
6 files changed, 26 insertions, 36 deletions
diff --git a/games/adventure/io.c b/games/adventure/io.c index 4b936a73dd2..849e1f061e4 100644 --- a/games/adventure/io.c +++ b/games/adventure/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.6 1998/09/12 01:54:42 pjanzen Exp $ */ +/* $OpenBSD: io.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $ */ /* $NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: io.c,v 1.6 1998/09/12 01:54:42 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $"; #endif #endif /* not lint */ @@ -333,10 +333,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(1); - } + if (oldloc > RTXSIZ) + errx(1, "Too many random msgs"); rtext[oldloc].seekadr = seekhere; rtext[oldloc].txtlen = maystart - seekstart; break; @@ -346,16 +344,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(1); - } + 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(1); + errx(1, "rdesc called with bad section"); } seekhere += maystart - seekstart; } diff --git a/games/adventure/main.c b/games/adventure/main.c index 24b19b7f7b5..f761ef3d63c 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.9 1998/09/02 06:36:07 pjanzen Exp $ */ +/* $OpenBSD: main.c,v 1.10 1998/11/29 19:45:10 pjanzen Exp $ */ /* $NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $ */ /*- @@ -49,7 +49,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.9 1998/09/02 06:36:07 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.10 1998/11/29 19:45:10 pjanzen Exp $"; #endif #endif /* not lint */ @@ -88,7 +88,7 @@ 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(1); /* So give up */ + errx(1, "can't open file"); /* So give up */ case 2: /* Oops -- file was altered */ rspeak(202); /* You dissolve */ exit(2); /* File could be non-adventure */ @@ -270,8 +270,7 @@ l2630: i = vocab(wd1, -1, 0); case 3: goto l4000; case 4: goto l2010; default: - printf("Error 22\n"); - exit(22); + bug(22); } l8: diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c index c5c6fd849f3..e936f484698 100644 --- a/games/adventure/vocab.c +++ b/games/adventure/vocab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vocab.c,v 1.6 1998/09/12 01:54:42 pjanzen Exp $ */ +/* $OpenBSD: vocab.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $ */ /* $NetBSD: vocab.c,v 1.2 1995/03/21 12:05:13 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: vocab.c,v 1.6 1998/09/12 01:54:42 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: vocab.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $"; #endif #endif /* not lint */ @@ -186,10 +186,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(1); - } + 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; @@ -200,10 +198,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(1); - } + if (adr + 1 == hash || (adr == HTSIZE && hash == 0)) + errx(1, "Hash table overflow"); } } diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c index 13e1ff444d8..c5998f529b6 100644 --- a/games/backgammon/common_source/subs.c +++ b/games/backgammon/common_source/subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subs.c,v 1.6 1998/09/02 06:46:51 pjanzen Exp $ */ +/* $OpenBSD: subs.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: subs.c,v 1.6 1998/09/02 06:46:51 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: subs.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $"; #endif #endif /* not lint */ @@ -326,7 +326,7 @@ getarg(argc,argv) args[acnt++] = 'n'; break; - case 'b': /* player is both read and white */ + case 'b': /* player is both red and white */ if (rflag) break; pnum = 0; diff --git a/games/monop/execute.c b/games/monop/execute.c index 95b38f7db53..770942efa0e 100644 --- a/games/monop/execute.c +++ b/games/monop/execute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: execute.c,v 1.2 1998/09/20 23:36:50 pjanzen Exp $ */ +/* $OpenBSD: execute.c,v 1.3 1998/11/29 19:45:11 pjanzen Exp $ */ /* $NetBSD: execute.c,v 1.3 1995/03/23 08:34:38 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: execute.c,v 1.2 1998/09/20 23:36:50 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: execute.c,v 1.3 1998/11/29 19:45:11 pjanzen Exp $"; #endif #endif /* not lint */ @@ -266,7 +266,7 @@ rest_f(file) char *start, *end; STAT sbuf; - if ((inf = open(file, 0)) < 0) { + if ((inf = open(file, O_RDONLY)) < 0) { warn(file); return FALSE; } diff --git a/games/trek/dumpgame.c b/games/trek/dumpgame.c index c8344f31506..e3ade385fdb 100644 --- a/games/trek/dumpgame.c +++ b/games/trek/dumpgame.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dumpgame.c,v 1.2 1998/08/19 07:41:29 pjanzen Exp $ */ +/* $OpenBSD: dumpgame.c,v 1.3 1998/11/29 19:45:11 pjanzen Exp $ */ /* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: dumpgame.c,v 1.2 1998/08/19 07:41:29 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: dumpgame.c,v 1.3 1998/11/29 19:45:11 pjanzen Exp $"; #endif #endif /* not lint */ @@ -130,7 +130,7 @@ restartgame() register int fd; int version; - if ((fd = open("trek.dump", 0)) < 0 || + if ((fd = open("trek.dump", O_RDONLY)) < 0 || read(fd, &version, sizeof version) != sizeof version || version != VERSION || readdump(fd)) |