Use err*(3)/warn*(3).

This commit is contained in:
mycroft 1995-03-22 15:25:56 +00:00
parent 73ab328b89
commit 05fc3892b3
2 changed files with 22 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.3 1995/03/22 15:20:31 mycroft Exp $ */
/* $NetBSD: main.c,v 1.4 1995/03/22 15:25:56 mycroft Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@ -43,14 +43,16 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/03/22 15:20:31 mycroft Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.4 1995/03/22 15:25:56 mycroft Exp $";
#endif /* not lint */
#include <sys/param.h>
#include <err.h>
#include <nlist.h>
#include <signal.h>
#include <stdio.h>
#include "systat.h"
#include "extern.h"
@ -92,16 +94,10 @@ main(argc, argv)
struct cmdtab *p;
p = lookup(&argv[0][1]);
if (p == (struct cmdtab *)-1) {
fprintf(stderr, "%s: ambiguous request\n",
&argv[0][1]);
exit(1);
}
if (p == 0) {
fprintf(stderr, "%s: unknown request\n",
&argv[0][1]);
exit(1);
}
if (p == (struct cmdtab *)-1)
errx(1, "ambiguous request: %s", &argv[0][1]);
if (p == 0)
errx(1, "unknown request: %s", &argv[0][1]);
curcmd = p;
} else {
naptime = atoi(argv[0]);
@ -119,10 +115,8 @@ main(argc, argv)
nlisterr(namelist);
exit(1);
}
if (namelist[X_FIRST].n_type == 0) {
fprintf(stderr, "couldn't read namelist.\n");
exit(1);
}
if (namelist[X_FIRST].n_type == 0)
errx(1, "couldn't read namelist");
signal(SIGINT, die);
signal(SIGQUIT, die);
signal(SIGTERM, die);
@ -137,12 +131,12 @@ main(argc, argv)
CMDLINE = LINES - 1;
wnd = (*curcmd->c_open)();
if (wnd == NULL) {
fprintf(stderr, "Couldn't initialize display.\n");
warnx("couldn't initialize display");
die(0);
}
wload = newwin(1, 0, 3, 20);
if (wload == NULL) {
fprintf(stderr, "Couldn't set up load average window.\n");
warnx("couldn't set up load average window");
die(0);
}
gethostname(hostname, sizeof (hostname));

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmstat.c,v 1.2 1995/01/20 08:52:16 jtc Exp $ */
/* $NetBSD: vmstat.c,v 1.3 1995/03/22 15:25:58 mycroft Exp $ */
/*-
* Copyright (c) 1983, 1989, 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
static char rcsid[] = "$NetBSD: vmstat.c,v 1.2 1995/01/20 08:52:16 jtc Exp $";
static char rcsid[] = "$NetBSD: vmstat.c,v 1.3 1995/03/22 15:25:58 mycroft Exp $";
#endif /* not lint */
/*
@ -55,14 +55,16 @@ static char rcsid[] = "$NetBSD: vmstat.c,v 1.2 1995/01/20 08:52:16 jtc Exp $";
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <signal.h>
#include <nlist.h>
#include <ctype.h>
#include <utmp.h>
#include <err.h>
#include <nlist.h>
#include <paths.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <utmp.h>
#include <unistd.h>
#include "systat.h"
#include "extern.h"
@ -638,10 +640,8 @@ allocinfo(s)
{
s->intrcnt = (long *) malloc(nintr * sizeof(long));
if (s->intrcnt == NULL) {
fprintf(stderr, "systat: out of memory\n");
exit(2);
}
if (s->intrcnt == NULL)
errx(2, "out of memory");
}
static void