summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-31 04:11:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-31 04:11:00 +0000
commit3addb8d9e0d3aa933924aca643062fdfc0be1d61 (patch)
tree1a173fbc248a7ad1e66d843f7104bd5712e0711b /usr.bin
parentee247746171554a209ff4077048269b68455ddd8 (diff)
fairly simple cleanup, lots of testing done
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/cmds.c16
-rw-r--r--usr.bin/systat/disks.c7
-rw-r--r--usr.bin/systat/extern.h10
-rw-r--r--usr.bin/systat/fetch.c6
-rw-r--r--usr.bin/systat/if.c13
-rw-r--r--usr.bin/systat/iostat.c16
-rw-r--r--usr.bin/systat/keyboard.c8
-rw-r--r--usr.bin/systat/main.c32
-rw-r--r--usr.bin/systat/mbufs.c22
-rw-r--r--usr.bin/systat/netcmds.c19
-rw-r--r--usr.bin/systat/netstat.c26
-rw-r--r--usr.bin/systat/pigs.c8
-rw-r--r--usr.bin/systat/swap.c6
-rw-r--r--usr.bin/systat/vmstat.c16
14 files changed, 110 insertions, 95 deletions
diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c
index c31435117ea..aef72aefd73 100644
--- a/usr.bin/systat/cmds.c
+++ b/usr.bin/systat/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.12 2003/06/03 02:56:17 millert Exp $ */
+/* $OpenBSD: cmds.c,v 1.13 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.4 1996/05/10 23:16:32 thorpej Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
#endif
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.12 2003/06/03 02:56:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.13 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <stdlib.h>
@@ -77,15 +77,17 @@ command(char *cmd)
goto done;
}
if (strcmp(cmd, "help") == 0) {
- int col, len;
+ size_t len;
+ int column = 0;
- move(CMDLINE, col = 0);
+ move(CMDLINE, column);
for (p = cmdtab; p->c_name; p++) {
len = strlen(p->c_name);
- if (col + len > COLS)
+ if (column + len > COLS)
break;
- addstr(p->c_name); col += len;
- if (col + 1 < COLS)
+ addstr(p->c_name);
+ column += len;
+ if (column + 1 < COLS)
addch(' ');
}
clrtoeol();
diff --git a/usr.bin/systat/disks.c b/usr.bin/systat/disks.c
index 06aa92475b6..ed540d16e7a 100644
--- a/usr.bin/systat/disks.c
+++ b/usr.bin/systat/disks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disks.c,v 1.14 2003/06/03 02:56:17 millert Exp $ */
+/* $OpenBSD: disks.c,v 1.15 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: disks.c,v 1.4 1996/05/10 23:16:33 thorpej Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: disks.c,v 1.14 2003/06/03 02:56:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: disks.c,v 1.15 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <string.h>
@@ -59,7 +59,8 @@ dkcmd(char *cmd, char *args)
if (prefix(cmd, "drives")) {
int i;
- move(CMDLINE, 0); clrtoeol();
+ move(CMDLINE, 0);
+ clrtoeol();
for (i = 0; i < dk_ndrive; i++)
printw("%s ", dr_name[i]);
return (1);
diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h
index fb63eea98d3..68c0a2c4ca5 100644
--- a/usr.bin/systat/extern.h
+++ b/usr.bin/systat/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.14 2004/11/16 09:52:33 markus Exp $ */
+/* $OpenBSD: extern.h,v 1.15 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: extern.h,v 1.3 1996/05/10 23:16:34 thorpej Exp $ */
/*-
@@ -41,16 +41,16 @@ extern struct cmdtab cmdtab[];
extern struct text *xtext;
extern WINDOW *wnd;
extern char **dr_name;
-extern char c, *namp, hostname[];
+extern char hostname[];
extern double avenrun[3];
extern float *dk_mspw;
extern kvm_t *kd;
extern long ntext, textp;
extern int *dk_select;
-extern long CMDLINE;
+extern int CMDLINE;
extern int dk_ndrive;
extern int hz, stathz;
-extern int naptime, col;
+extern u_int naptime;
extern int nhosts;
extern int nports;
extern int protos;
@@ -97,7 +97,7 @@ int initnetstat(void);
int initpigs(void);
int initswap(void);
void keyboard(void);
-int kvm_ckread(void *, void *, int);
+int kvm_ckread(void *, void *, size_t);
void labelifstat(void);
void labeliostat(void);
void labelkre(void);
diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c
index d006adde79a..ce0cd54871d 100644
--- a/usr.bin/systat/fetch.c
+++ b/usr.bin/systat/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.7 2003/06/03 02:56:17 millert Exp $ */
+/* $OpenBSD: fetch.c,v 1.8 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: fetch.c,v 1.2 1995/01/20 08:51:56 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: fetch.c,v 1.7 2003/06/03 02:56:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: fetch.c,v 1.8 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -43,7 +43,7 @@ static char rcsid[] = "$OpenBSD: fetch.c,v 1.7 2003/06/03 02:56:17 millert Exp $
#include "extern.h"
int
-kvm_ckread(void *a, void *b, int l)
+kvm_ckread(void *a, void *b, size_t l)
{
if (kvm_read(kd, (u_long)a, b, l) != l) {
if (verbose)
diff --git a/usr.bin/systat/if.c b/usr.bin/systat/if.c
index 5fbd4f53b2a..c16c5e3e389 100644
--- a/usr.bin/systat/if.c
+++ b/usr.bin/systat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.4 2006/01/10 23:29:41 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.5 2006/03/31 04:10:59 deraadt Exp $ */
/*
* Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
*
@@ -23,6 +23,7 @@
#include <net/route.h>
#include <stdlib.h>
+#include <string.h>
#include "systat.h"
#include "extern.h"
@@ -47,7 +48,7 @@ struct ifstat {
} *ifstats;
static int nifs = 0;
-extern int naptime;
+extern u_int naptime;
WINDOW *
openifstat(void)
@@ -109,7 +110,7 @@ fetchifstat(void)
struct sockaddr *info[RTAX_MAX];
struct sockaddr_dl *sdl;
char *buf, *next, *lim;
- int mib[6], i;
+ int mib[6];
size_t need;
mib[0] = CTL_NET;
@@ -178,7 +179,8 @@ void
labelifstat(void)
{
- wmove(wnd, 0, 0); wclrtobot(wnd);
+ wmove(wnd, 0, 0);
+ wclrtobot(wnd);
mvwaddstr(wnd, 1, INSET, "Interfaces");
mvwaddstr(wnd, 1, INSET+15, "Ibytes");
@@ -199,7 +201,8 @@ showifstat(void)
struct ifstat *ifs;
row = 2;
- wmove(wnd, 0, 0); wclrtoeol(wnd);
+ wmove(wnd, 0, 0);
+ wclrtoeol(wnd);
for (ifs = ifstats; ifs < ifstats + nifs; ifs++) {
if (ifs->ifs_name[0] == '\0')
continue;
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index 92b27a5f310..2d3e69c077a 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.23 2004/02/15 22:56:12 tedu Exp $ */
+/* $OpenBSD: iostat.c,v 1.24 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: iostat.c,v 1.5 1996/05/10 23:16:35 thorpej Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: iostat.c,v 1.23 2004/02/15 22:56:12 tedu Exp $";
+static char rcsid[] = "$OpenBSD: iostat.c,v 1.24 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -308,16 +308,16 @@ static void
stat1(int row, int o)
{
int i;
- double time;
+ double tim;
- time = 0;
+ tim = 0;
for (i = 0; i < CPUSTATES; i++)
- time += cur.cp_time[i];
- if (time == 0.0)
- time = 1.0;
+ tim += cur.cp_time[i];
+ if (tim == 0.0)
+ tim = 1.0;
wmove(wnd, row, INSET);
#define CPUSCALE 0.5
- histogram(100.0 * cur.cp_time[o] / time, 50, CPUSCALE);
+ histogram(100.0 * cur.cp_time[o] / tim, 50, CPUSCALE);
}
static void
diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c
index 5aadd2dcb0a..dc3511cf8d0 100644
--- a/usr.bin/systat/keyboard.c
+++ b/usr.bin/systat/keyboard.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyboard.c,v 1.17 2005/08/01 22:51:50 millert Exp $ */
+/* $OpenBSD: keyboard.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: keyboard.c,v 1.2 1995/01/20 08:51:59 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: keyboard.c,v 1.17 2005/08/01 22:51:50 millert Exp $";
+static char rcsid[] = "$OpenBSD: keyboard.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -53,7 +53,7 @@ keyboard(void)
{
char line[80];
sigset_t mask, omask;
- int ch;
+ int ch, col;
for (;;) {
col = 0;
@@ -147,7 +147,7 @@ keyboard(void)
}
if (isprint(ch) || ch == ' ') {
line[col] = ch;
- mvaddch(CMDLINE, col, ch);
+ mvaddch(CMDLINE, col, (chtype)ch);
col++;
}
} while (col == 0 || (ch != '\r' && ch != '\n'));
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index f74c6647eb6..753175be9cc 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.31 2005/07/04 01:54:10 djm Exp $ */
+/* $OpenBSD: main.c,v 1.32 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: main.c,v 1.8 1996/05/10 23:16:36 thorpej Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: main.c,v 1.31 2005/07/04 01:54:10 djm Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.32 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -65,18 +65,14 @@ double dellave;
kvm_t *kd;
char *nlistf = NULL;
char *memf = NULL;
-sig_t sigtstpdfl;
double avenrun[3];
-int col;
-int naptime = 5;
+u_int naptime = 5;
int verbose = 1; /* to report kvm read errs */
int nflag = 0;
int hz, stathz;
-char c;
-char *namp;
char hostname[MAXHOSTNAMELEN];
WINDOW *wnd;
-long CMDLINE;
+int CMDLINE;
WINDOW *wload; /* one line window for load average */
@@ -87,6 +83,7 @@ main(int argc, char *argv[])
{
int ch;
char errbuf[_POSIX2_LINE_MAX];
+ const char *errstr;
gid_t gid;
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
@@ -105,8 +102,9 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 'w':
- if ((naptime = atoi(optarg)) <= 0)
- errx(1, "interval <= 0.");
+ naptime = (u_int)strtonum(optarg, 0, 1000, &errstr);
+ if (errstr)
+ errx(1, "interval <= 0: %s", errstr);
break;
default:
usage();
@@ -116,8 +114,8 @@ main(int argc, char *argv[])
while (argc > 0) {
if (isdigit(argv[0][0])) {
- naptime = atoi(argv[0]);
- if (naptime <= 0)
+ naptime = (u_int)strtonum(argv[0], 0, 1000, &errstr);
+ if (errstr)
naptime = 5;
} else {
struct cmdtab *p;
@@ -221,9 +219,9 @@ labels(void)
refresh();
}
+/*ARGSUSED*/
void
-sigdisplay(signo)
- int signo;
+sigdisplay(int signo)
{
gotdisplay = 1;
}
@@ -232,6 +230,7 @@ void
display(void)
{
int i, j;
+ chtype c;
/* Get the load average over the last minute. */
(void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
@@ -259,7 +258,7 @@ display(void)
if (curcmd->c_flags & CF_LOADAV)
wrefresh(wload);
wrefresh(wnd);
- move(CMDLINE, col);
+ move(CMDLINE, 0);
refresh();
alarm(naptime);
}
@@ -279,12 +278,14 @@ volatile sig_atomic_t gotdisplay;
volatile sig_atomic_t gotwinch;
volatile sig_atomic_t gottstp;
+/*ARGSUSED*/
void
sigdie(int signo)
{
gotdie = 1;
}
+/*ARGSUSED*/
void
sigtstp(int signo)
{
@@ -303,6 +304,7 @@ die(void)
exit(0);
}
+/*ARGSUSED*/
void
sigwinch(int signo)
{
diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c
index a967ef5aec2..d0d5f7c1989 100644
--- a/usr.bin/systat/mbufs.c
+++ b/usr.bin/systat/mbufs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbufs.c,v 1.15 2004/07/09 16:33:15 deraadt Exp $ */
+/* $OpenBSD: mbufs.c,v 1.16 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: mbufs.c,v 1.2 1995/01/20 08:52:02 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: mbufs.c,v 1.15 2004/07/09 16:33:15 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mbufs.c,v 1.16 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -89,7 +89,8 @@ closembufs(WINDOW *w)
void
labelmbufs(void)
{
- wmove(wnd, 0, 0); wclrtoeol(wnd);
+ wmove(wnd, 0, 0);
+ wclrtoeol(wnd);
mvwaddstr(wnd, 0, 10,
"/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50 /55 /60");
}
@@ -97,22 +98,22 @@ labelmbufs(void)
void
showmbufs(void)
{
- int i, j, max, index;
+ int i, j, max, ind;
char buf[13];
for (j = 0; j < wnd->_maxy; j++) {
- max = 0, index = -1;
+ max = 0, ind = -1;
for (i = 0; i < wnd->_maxy; i++)
if (mb.m_mtypes[i] > max) {
max = mb.m_mtypes[i];
- index = i;
+ ind = i;
}
if (max == 0)
break;
if (j > NNAMES)
- mvwprintw(wnd, 1+j, 0, "%10d", index);
+ mvwprintw(wnd, 1+j, 0, "%10d", ind);
else
- mvwprintw(wnd, 1+j, 0, "%-10.10s", mtnames[index]);
+ mvwprintw(wnd, 1+j, 0, "%-10.10s", mtnames[ind]);
wmove(wnd, 1 + j, 10);
if (max > 60) {
snprintf(buf, sizeof buf, " %d", max);
@@ -125,9 +126,10 @@ showmbufs(void)
waddch(wnd, 'X');
wclrtoeol(wnd);
}
- mb.m_mtypes[index] = 0;
+ mb.m_mtypes[ind] = 0;
}
- wmove(wnd, 1+j, 0); wclrtobot(wnd);
+ wmove(wnd, 1+j, 0);
+ wclrtobot(wnd);
}
diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c
index 9b555f70f61..e25aff60d86 100644
--- a/usr.bin/systat/netcmds.c
+++ b/usr.bin/systat/netcmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcmds.c,v 1.15 2005/03/13 19:00:45 cloder Exp $ */
+/* $OpenBSD: netcmds.c,v 1.16 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: netcmds.c,v 1.4 1995/05/21 17:14:38 mycroft Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: netcmds.c,v 1.15 2005/03/13 19:00:45 cloder Exp $";
+static char rcsid[] = "$OpenBSD: netcmds.c,v 1.16 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
/*
@@ -98,7 +98,8 @@ netcmd(char *cmd, char *args)
return (1);
}
if (prefix(cmd, "show")) {
- move(CMDLINE, 0); clrtoeol();
+ move(CMDLINE, 0);
+ clrtoeol();
if (*args == '\0') {
showprotos();
showhosts();
@@ -198,7 +199,8 @@ selectport(long port, int onoff)
if (ntohs(port) == -1) {
if (ports == 0)
return (0);
- free((char *)ports), ports = 0;
+ free(ports);
+ ports = NULL;
nports = 0;
return (1);
}
@@ -257,12 +259,12 @@ addrcmp(struct sockaddr *sa1, struct sockaddr *sa2)
switch (sa1->sa_family) {
case AF_INET:
if (((struct sockaddr_in *)sa1)->sin_addr.s_addr ==
- ((struct sockaddr_in *)sa2)->sin_addr.s_addr)
+ ((struct sockaddr_in *)sa2)->sin_addr.s_addr)
return 1;
break;
case AF_INET6:
if (IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)sa1)->sin6_addr,
- &((struct sockaddr_in6 *)sa2)->sin6_addr))
+ &((struct sockaddr_in6 *)sa2)->sin6_addr))
return 1;
break;
default:
@@ -281,7 +283,8 @@ selecthost(struct sockaddr *sa, int onoff)
if (sa == 0) {
if (hosts == 0)
return (0);
- free((char *)hosts), hosts = 0;
+ free(hosts);
+ hosts = NULL;
nhosts = 0;
return (1);
}
@@ -341,7 +344,7 @@ showhosts(void)
for (p = hosts; p < hosts+nhosts; p++) {
sa = (struct sockaddr *)&p->addr;
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
- flags) != 0)
+ flags) != 0)
strlcpy(hbuf, "(invalid)", sizeof hbuf);
if (!p->onoff)
addch('!');
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c
index 2d81da1c9ad..b8bdaa6cf5a 100644
--- a/usr.bin/systat/netstat.c
+++ b/usr.bin/systat/netstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netstat.c,v 1.28 2005/10/17 19:04:20 otto Exp $ */
+/* $OpenBSD: netstat.c,v 1.29 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: netstat.c,v 1.28 2005/10/17 19:04:20 otto Exp $";
+static char rcsid[] = "$OpenBSD: netstat.c,v 1.29 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
/*
@@ -317,7 +317,8 @@ labelnetstat(void)
{
if (namelist[X_TCBTABLE].n_type == 0)
return;
- wmove(wnd, 0, 0); wclrtobot(wnd);
+ wmove(wnd, 0, 0);
+ wclrtobot(wnd);
mvwaddstr(wnd, 0, LADDR, "Local Address");
mvwaddstr(wnd, 0, FADDR, "Foreign Address");
mvwaddstr(wnd, 0, PROTO, "Proto");
@@ -342,7 +343,8 @@ shownetstat(void)
p = p->nif_forw;
continue;
}
- wmove(wnd, p->nif_line, 0); wdeleteln(wnd);
+ wmove(wnd, p->nif_line, 0);
+ wdeleteln(wnd);
q = netcb.nif_forw;
for (; q != (struct netinfo *)&netcb; q = q->nif_forw)
if (q != p && q->nif_line > p->nif_line) {
@@ -375,11 +377,11 @@ shownetstat(void)
switch (p->nif_family) {
case AF_INET:
inetprint(&p->nif_laddr, p->nif_lport,
- p->nif_proto);
+ p->nif_proto);
break;
case AF_INET6:
inet6print(&p->nif_laddr6, p->nif_lport,
- p->nif_proto);
+ p->nif_proto);
break;
}
p->nif_flags &= ~NIF_LACHG;
@@ -389,11 +391,11 @@ shownetstat(void)
switch (p->nif_family) {
case AF_INET:
inetprint(&p->nif_faddr, p->nif_fport,
- p->nif_proto);
+ p->nif_proto);
break;
case AF_INET6:
inet6print(&p->nif_faddr6, p->nif_fport,
- p->nif_proto);
+ p->nif_proto);
break;
}
p->nif_flags &= ~NIF_FACHG;
@@ -414,8 +416,10 @@ shownetstat(void)
wclrtoeol(wnd);
}
if (lastrow < YMAX(wnd)) {
- wmove(wnd, lastrow, 0); wclrtobot(wnd);
- wmove(wnd, YMAX(wnd), 0); wdeleteln(wnd); /* XXX */
+ wmove(wnd, lastrow, 0);
+ wclrtobot(wnd);
+ wmove(wnd, YMAX(wnd), 0);
+ wdeleteln(wnd); /* XXX */
}
}
@@ -494,7 +498,7 @@ inetname(struct in_addr in)
cp = np->n_name;
}
if (cp == 0) {
- hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
+ hp = gethostbyaddr(&in, sizeof (in), AF_INET);
if (hp)
cp = hp->h_name;
}
diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c
index 99019630107..93e45f77cdf 100644
--- a/usr.bin/systat/pigs.c
+++ b/usr.bin/systat/pigs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pigs.c,v 1.17 2006/02/01 19:05:25 otto Exp $ */
+/* $OpenBSD: pigs.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: pigs.c,v 1.3 1995/04/29 05:54:50 cgd Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93";
#endif
-static char rcsid[] = "$OpenBSD: pigs.c,v 1.17 2006/02/01 19:05:25 otto Exp $";
+static char rcsid[] = "$OpenBSD: pigs.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
/*
@@ -229,6 +229,6 @@ labelpigs(void)
int
compar(const void *a, const void *b)
{
- return (((struct p_times *) a)->pt_pctcpu >
- ((struct p_times *) b)->pt_pctcpu)? -1: 1;
+ return (((struct p_times *)a)->pt_pctcpu >
+ ((struct p_times *)b)->pt_pctcpu) ? -1 : 1;
}
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
index 1aaa5a9539f..2752e09aee6 100644
--- a/usr.bin/systat/swap.c
+++ b/usr.bin/systat/swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swap.c,v 1.17 2003/06/03 02:56:17 millert Exp $ */
+/* $OpenBSD: swap.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: swap.c,v 1.9 1998/12/26 07:05:08 marc Exp $ */
/*-
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95";
#endif
-static char rcsid[] = "$OpenBSD: swap.c,v 1.17 2003/06/03 02:56:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: swap.c,v 1.18 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -55,8 +55,6 @@ static char rcsid[] = "$OpenBSD: swap.c,v 1.17 2003/06/03 02:56:17 millert Exp $
#include "systat.h"
#include "extern.h"
-void showspace(char *header, int hlen, long blocksize);
-
static long blocksize;
static int hlen, nswap, rnswap;
static int first = 1;
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 6e8411d15fc..40541311661 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmstat.c,v 1.56 2006/03/28 09:03:46 mickey Exp $ */
+/* $OpenBSD: vmstat.c,v 1.57 2006/03/31 04:10:59 deraadt Exp $ */
/* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
-static char rcsid[] = "$OpenBSD: vmstat.c,v 1.56 2006/03/28 09:03:46 mickey Exp $";
+static char rcsid[] = "$OpenBSD: vmstat.c,v 1.57 2006/03/31 04:10:59 deraadt Exp $";
#endif /* not lint */
/*
@@ -89,7 +89,7 @@ static void allocinfo(struct Info *);
static void copyinfo(struct Info *, struct Info *);
static float cputime(int);
static void dinfo(int, int);
-static void getinfo(struct Info *, enum state);
+static void getinfo(struct Info *);
static void putint(int, int, int, int);
static void putuint64(u_int64_t, int, int, int);
static void putfloat(double, int, int, int, int, int);
@@ -160,7 +160,7 @@ int ncpu = 1;
int
initkre(void)
{
- int mib[4], i, ret;
+ int mib[4], i;
size_t size;
mib[0] = CTL_HW;
@@ -205,7 +205,7 @@ initkre(void)
allocinfo(&s2);
allocinfo(&z);
- getinfo(&s2, RUN);
+ getinfo(&s2);
copyinfo(&s2, &s1);
return(1);
}
@@ -217,7 +217,7 @@ fetchkre(void)
time(&now);
strlcpy(buf, ctime(&now), sizeof buf);
- getinfo(&s, state);
+ getinfo(&s);
}
void
@@ -508,7 +508,7 @@ cmdkre(char *cmd, char *args)
}
if (prefix(cmd, "zero")) {
if (state == RUN)
- getinfo(&s1, RUN);
+ getinfo(&s1);
return (1);
}
return (dkcmd(cmd, args));
@@ -605,7 +605,7 @@ putfloat(double f, int l, int c, int w, int d, int nz)
}
static void
-getinfo(struct Info *s, enum state st)
+getinfo(struct Info *s)
{
static int cp_time_mib[] = { CTL_KERN, KERN_CPTIME };
static int nchstats_mib[2] = { CTL_KERN, KERN_NCHSTATS };