summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/main.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-13 06:45:11 +0000
committercharnier <charnier@FreeBSD.org>1997-08-13 06:45:11 +0000
commitd1a307d129d105dee069f5755f92a715d49cccc7 (patch)
treea615e79d13bf22177e06df7420227f7a27a61a12 /usr.bin/systat/main.c
parent30f274935dad98d54395e3b115cbd6b314a87ec2 (diff)
downloadFreeBSD-src-d1a307d129d105dee069f5755f92a715d49cccc7.zip
FreeBSD-src-d1a307d129d105dee069f5755f92a715d49cccc7.tar.gz
Use err(3). /sys/dkstat.h -> /usr/include/sys/dkstat.h
Diffstat (limited to 'usr.bin/systat/main.c')
-rw-r--r--usr.bin/systat/main.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index 78dd716..6ddee0e 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -38,11 +38,16 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/param.h>
+#include <err.h>
#include <locale.h>
#include <nlist.h>
#include <signal.h>
@@ -91,16 +96,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 == (struct cmdtab *)0) {
- fprintf(stderr, "%s: unknown request\n",
- &argv[0][1]);
- exit(1);
- }
+ if (p == (struct cmdtab *)-1)
+ errx(1, "%s: ambiguous request", &argv[0][1]);
+ if (p == (struct cmdtab *)0)
+ errx(1, "%s: unknown request", &argv[0][1]);
curcmd = p;
} else {
naptime = atoi(argv[0]);
@@ -128,22 +127,20 @@ 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);
}
if (kvm_nlist(kd, namelist)) {
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");
gethostname(hostname, sizeof (hostname));
NREAD(X_HZ, &hz, LONG);
NREAD(X_STATHZ, &stathz, LONG);
OpenPOWER on IntegriCloud