From e55a4c69ad6dfa55e6a3262864f6dce13f495ba3 Mon Sep 17 00:00:00 2001 From: jsm Date: Sun, 9 Jan 2000 17:17:19 +0000 Subject: Use err(1, NULL) and warn(NULL) for `out of memory' error messages. --- adventure/io.c | 10 +++++----- adventure/vocab.c | 6 +++--- battlestar/save.c | 10 +++++----- caesar/caesar.c | 6 +++--- monop/monop.c | 8 ++++---- worm/worm.c | 10 +++++----- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/adventure/io.c b/adventure/io.c index bbe54d92..e3c80e89 100644 --- a/adventure/io.c +++ b/adventure/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.11 1999/02/10 00:11:28 hubertf Exp $ */ +/* $NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm 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.11 1999/02/10 00:11:28 hubertf Exp $"); +__RCSID("$NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm Exp $"); #endif #endif /* not lint */ @@ -361,7 +361,7 @@ rtrav() if (locc != oldloc) { /* getting a new entry */ t = travel[locc] = (struct travlist *) malloc(sizeof(struct travlist)); if ( t == NULL) - errx(1, "Out of memory!"); + err(1, NULL); /* printf("New travel list for %d\n",locc); */ entries = 0; oldloc = locc; @@ -384,7 +384,7 @@ rtrav() if (entries++) { t = t->next = (struct travlist *) malloc(sizeof(struct travlist)); if (t == NULL) - errx(1, "Out of memory!"); + err(1, NULL); } t->tverb = rnum(); /* get verb from the file */ t->tloc = n; /* table entry mod 1000 */ @@ -559,7 +559,7 @@ pspeak(m, skip) /* read, decrypt an print a ptext message */ msg = &ptext[m]; if ((tbuf = (char *) malloc(msg->txtlen + 1)) == NULL) - errx(1, "Out of memory!"); + err(1, NULL); memcpy(tbuf, msg->seekadr, msg->txtlen + 1); /* Room to null */ s = tbuf; diff --git a/adventure/vocab.c b/adventure/vocab.c index 5acc8b96..f1e4d503 100644 --- a/adventure/vocab.c +++ b/adventure/vocab.c @@ -1,4 +1,4 @@ -/* $NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $ */ +/* $NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm 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.9 1998/09/14 09:29:09 hubertf Exp $"); +__RCSID("$NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $"); #endif #endif /* not lint */ @@ -165,7 +165,7 @@ vocab(word, type, value) /* look up or store a word */ h->val = value; h->atab = malloc(length(word)); if (h->atab == NULL) - errx(1, "Out of memory!"); + err(1, NULL); for (s = word, t = h->atab; *s;) *t++ = *s++ ^ '='; *t = 0 ^ '='; diff --git a/battlestar/save.c b/battlestar/save.c index d42793fc..e37d109f 100644 --- a/battlestar/save.c +++ b/battlestar/save.c @@ -1,4 +1,4 @@ -/* $NetBSD: save.c,v 1.9 1999/07/28 01:45:43 hubertf Exp $ */ +/* $NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)save.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: save.c,v 1.9 1999/07/28 01:45:43 hubertf Exp $"); +__RCSID("$NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $"); #endif #endif /* not lint */ @@ -171,7 +171,7 @@ save_file_name(filename, len) if (memchr(filename, '/', len)) { newname = malloc(len + 1); if (newname == NULL) { - warnx("out of memory"); + warn(NULL); return NULL; } memcpy(newname, filename, len); @@ -182,7 +182,7 @@ save_file_name(filename, len) tmpl = strlen(home); newname = malloc(tmpl + len + 2); if (newname == NULL) { - warnx("out of memory"); + warn(NULL); return NULL; } memcpy(newname, home, tmpl); @@ -192,7 +192,7 @@ save_file_name(filename, len) } else { newname = malloc(len + 1); if (newname == NULL) { - warnx("out of memory"); + warn(NULL); return NULL; } memcpy(newname, filename, len); diff --git a/caesar/caesar.c b/caesar/caesar.c index 8209edde..99bcd7e3 100644 --- a/caesar/caesar.c +++ b/caesar/caesar.c @@ -1,4 +1,4 @@ -/* $NetBSD: caesar.c,v 1.9 1999/09/08 21:17:46 jsm Exp $ */ +/* $NetBSD: caesar.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */ /* * Copyright (c) 1989, 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: caesar.c,v 1.9 1999/09/08 21:17:46 jsm Exp $"); +__RCSID("$NetBSD: caesar.c,v 1.10 2000/01/09 17:17:20 jsm Exp $"); #endif #endif /* not lint */ @@ -100,7 +100,7 @@ main(argc, argv) printit(argv[1]); if (!(inbuf = malloc(LINELENGTH))) - errx(1, "out of memory"); + err(1, NULL); /* adjust frequency table to weight low probs REAL low */ for (i = 0; i < 26; ++i) diff --git a/monop/monop.c b/monop/monop.c index 289f2b12..31743f19 100644 --- a/monop/monop.c +++ b/monop/monop.c @@ -1,4 +1,4 @@ -/* $NetBSD: monop.c,v 1.9 1999/09/12 09:02:22 jsm Exp $ */ +/* $NetBSD: monop.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: monop.c,v 1.9 1999/09/12 09:02:22 jsm Exp $"); +__RCSID("$NetBSD: monop.c,v 1.10 2000/01/09 17:17:20 jsm Exp $"); #endif #endif /* not lint */ @@ -120,7 +120,7 @@ blew_it: } cur_p = play = (PLAY *) calloc(num_play, sizeof (PLAY)); if (play == NULL) - errx(1, "out of memory"); + err(1, NULL); for (i = 0; i < num_play; i++) { over: printf("Player %d's name: ", i + 1); @@ -131,7 +131,7 @@ over: *sp++ = '\0'; name_list[i] = play[i].name = (char *)calloc(1, sp - buf); if (name_list[i] == NULL) - errx(1, "out of memory"); + err(1, NULL); strcpy(play[i].name, buf); play[i].money = 1500; } diff --git a/worm/worm.c b/worm/worm.c index 25d84c3b..1a03ee72 100644 --- a/worm/worm.c +++ b/worm/worm.c @@ -1,4 +1,4 @@ -/* $NetBSD: worm.c,v 1.17 1999/10/26 06:35:49 cgd Exp $ */ +/* $NetBSD: worm.c,v 1.18 2000/01/09 17:17:21 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: worm.c,v 1.17 1999/10/26 06:35:49 cgd Exp $"); +__RCSID("$NetBSD: worm.c,v 1.18 2000/01/09 17:17:21 jsm Exp $"); #endif #endif /* not lint */ @@ -157,7 +157,7 @@ life() np = NULL; head = newlink(); if (head == NULL) - errx(1, "out of memory"); + err(1, NULL); head->x = start_len+2; head->y = 12; head->next = NULL; @@ -165,7 +165,7 @@ life() for (i = 0, bp = head; i < start_len; i++, bp = np) { np = newlink(); if (np == NULL) - errx(1, "out of memory"); + err(1, NULL); np->next = bp; bp->prev = np; np->x = bp->x - 1; @@ -312,7 +312,7 @@ process(ch) else if(ch != ' ') crash(); nh = newlink(); if (nh == NULL) - errx(1, "out of memory"); + err(1, NULL); nh->next = NULL; nh->prev = head; head->next = nh; -- cgit v1.2.3-56-ge451