fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
This commit is contained in:
parent
49e5f15617
commit
9ccb9cd874
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.8 1997/07/21 07:03:52 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.9 1997/10/19 23:36:20 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
|
||||
PROG= systat
|
||||
|
@ -12,6 +12,5 @@ DPADD= ${LIBCURSES} ${LIBTERMCAP} ${LIBM} ${LIBKVM}
|
|||
LDADD= -lcurses -ltermcap -lm -lkvm
|
||||
BINGRP= kmem
|
||||
BINMODE=2555
|
||||
WARNS?= 1
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cmds.c,v 1.7 1997/07/21 07:04:56 mrg Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.8 1997/10/19 23:36:21 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
|
||||
#endif
|
||||
__RCSID("$NetBSD: cmds.c,v 1.7 1997/07/21 07:04:56 mrg Exp $");
|
||||
__RCSID("$NetBSD: cmds.c,v 1.8 1997/10/19 23:36:21 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -53,8 +53,8 @@ void
|
|||
command(cmd)
|
||||
char *cmd;
|
||||
{
|
||||
register struct cmdtab *p;
|
||||
register char *cp;
|
||||
struct cmdtab *p;
|
||||
char *cp;
|
||||
int interval;
|
||||
sigset_t set;
|
||||
|
||||
|
@ -152,11 +152,11 @@ done:
|
|||
|
||||
struct cmdtab *
|
||||
lookup(name)
|
||||
register char *name;
|
||||
char *name;
|
||||
{
|
||||
register char *p, *q;
|
||||
register struct cmdtab *c, *found;
|
||||
register int nmatches, longest;
|
||||
char *p, *q;
|
||||
struct cmdtab *c, *found;
|
||||
int nmatches, longest;
|
||||
|
||||
longest = 0;
|
||||
nmatches = 0;
|
||||
|
@ -187,7 +187,7 @@ status()
|
|||
|
||||
int
|
||||
prefix(s1, s2)
|
||||
register char *s1, *s2;
|
||||
char *s1, *s2;
|
||||
{
|
||||
|
||||
while (*s1 == *s2) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disks.c,v 1.5 1997/07/21 07:04:59 mrg Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.6 1997/10/19 23:36:23 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: disks.c,v 1.5 1997/07/21 07:04:59 mrg Exp $");
|
||||
__RCSID("$NetBSD: disks.c,v 1.6 1997/10/19 23:36:23 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -66,7 +66,7 @@ dkcmd(cmd, args)
|
|||
return (1);
|
||||
}
|
||||
if (prefix(cmd, "drives")) {
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
move(CMDLINE, 0); clrtoeol();
|
||||
for (i = 0; i < dk_ndrive; i++)
|
||||
|
@ -81,10 +81,10 @@ dkselect(args, truefalse, selections)
|
|||
char *args;
|
||||
int truefalse, selections[];
|
||||
{
|
||||
register char *cp;
|
||||
register int i;
|
||||
char *cp;
|
||||
int i;
|
||||
|
||||
cp = index(args, '\n');
|
||||
cp = strchr(args, '\n');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
for (;;) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iostat.c,v 1.8 1997/07/21 07:05:01 mrg Exp $ */
|
||||
/* $NetBSD: iostat.c,v 1.9 1997/10/19 23:36:24 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: iostat.c,v 1.8 1997/07/21 07:05:01 mrg Exp $");
|
||||
__RCSID("$NetBSD: iostat.c,v 1.9 1997/10/19 23:36:24 lukem Exp $");
|
||||
#endif not lint
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -195,7 +195,7 @@ barlabels(row)
|
|||
void
|
||||
showiostat()
|
||||
{
|
||||
register int i, row, col;
|
||||
int i, row, col;
|
||||
|
||||
if (dk_ndrive == 0)
|
||||
return;
|
||||
|
@ -278,7 +278,7 @@ static void
|
|||
stat1(row, o)
|
||||
int row, o;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
double time;
|
||||
|
||||
time = 0;
|
||||
|
@ -298,8 +298,8 @@ histogram(val, colwidth, scale)
|
|||
double scale;
|
||||
{
|
||||
char buf[10];
|
||||
register int k;
|
||||
register int v = (int)(val * scale) + 0.5;
|
||||
int k;
|
||||
int v = (int)(val * scale) + 0.5;
|
||||
|
||||
k = MIN(v, colwidth);
|
||||
if (v > colwidth) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.11 1997/07/21 07:05:03 mrg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.12 1997/10/19 23:36:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: main.c,v 1.11 1997/07/21 07:05:03 mrg Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.12 1997/10/19 23:36:26 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -96,7 +96,7 @@ main(argc, argv)
|
|||
int ch;
|
||||
char errbuf[_POSIX2_LINE_MAX];
|
||||
|
||||
while ((ch = getopt(argc, argv, "M:N:w:")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "M:N:w:")) != -1)
|
||||
switch(ch) {
|
||||
case 'M':
|
||||
memf = optarg;
|
||||
|
@ -221,7 +221,7 @@ void
|
|||
display(signo)
|
||||
int signo;
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
/* Get the load average over the last minute. */
|
||||
(void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mbufs.c,v 1.4 1997/07/21 07:05:04 mrg Exp $ */
|
||||
/* $NetBSD: mbufs.c,v 1.5 1997/10/19 23:36:27 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: mbufs.c,v 1.4 1997/07/21 07:05:04 mrg Exp $");
|
||||
__RCSID("$NetBSD: mbufs.c,v 1.5 1997/10/19 23:36:27 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -101,7 +101,7 @@ labelmbufs()
|
|||
void
|
||||
showmbufs()
|
||||
{
|
||||
register int i, j, max, index;
|
||||
int i, j, max, index;
|
||||
char buf[10];
|
||||
|
||||
if (mb == 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netcmds.c,v 1.5 1997/07/21 07:05:05 mrg Exp $ */
|
||||
/* $NetBSD: netcmds.c,v 1.6 1997/10/19 23:36:28 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: netcmds.c,v 1.5 1997/07/21 07:05:05 mrg Exp $");
|
||||
__RCSID("$NetBSD: netcmds.c,v 1.6 1997/10/19 23:36:28 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -128,12 +128,12 @@ changeitems(args, onoff)
|
|||
char *args;
|
||||
int onoff;
|
||||
{
|
||||
register char *cp;
|
||||
char *cp;
|
||||
struct servent *sp;
|
||||
struct hostent *hp;
|
||||
struct in_addr in;
|
||||
|
||||
cp = index(args, '\n');
|
||||
cp = strchr(args, '\n');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
for (;;args = cp) {
|
||||
|
@ -199,7 +199,7 @@ selectport(port, onoff)
|
|||
long port;
|
||||
int onoff;
|
||||
{
|
||||
register struct pitem *p;
|
||||
struct pitem *p;
|
||||
|
||||
if (port == -1) {
|
||||
if (ports == 0)
|
||||
|
@ -225,9 +225,9 @@ selectport(port, onoff)
|
|||
|
||||
int
|
||||
checkport(inp)
|
||||
register struct inpcb *inp;
|
||||
struct inpcb *inp;
|
||||
{
|
||||
register struct pitem *p;
|
||||
struct pitem *p;
|
||||
|
||||
if (ports)
|
||||
for (p = ports; p < ports+nports; p++)
|
||||
|
@ -239,7 +239,7 @@ checkport(inp)
|
|||
static void
|
||||
showports()
|
||||
{
|
||||
register struct pitem *p;
|
||||
struct pitem *p;
|
||||
struct servent *sp;
|
||||
|
||||
for (p = ports; p < ports+nports; p++) {
|
||||
|
@ -259,7 +259,7 @@ selecthost(in, onoff)
|
|||
struct in_addr *in;
|
||||
int onoff;
|
||||
{
|
||||
register struct hitem *p;
|
||||
struct hitem *p;
|
||||
|
||||
if (in == 0) {
|
||||
if (hosts == 0)
|
||||
|
@ -285,9 +285,9 @@ selecthost(in, onoff)
|
|||
|
||||
int
|
||||
checkhost(inp)
|
||||
register struct inpcb *inp;
|
||||
struct inpcb *inp;
|
||||
{
|
||||
register struct hitem *p;
|
||||
struct hitem *p;
|
||||
|
||||
if (hosts)
|
||||
for (p = hosts; p < hosts+nhosts; p++)
|
||||
|
@ -300,7 +300,7 @@ checkhost(inp)
|
|||
static void
|
||||
showhosts()
|
||||
{
|
||||
register struct hitem *p;
|
||||
struct hitem *p;
|
||||
struct hostent *hp;
|
||||
|
||||
for (p = hosts; p < hosts+nhosts; p++) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netstat.c,v 1.7 1997/07/21 07:05:06 mrg Exp $ */
|
||||
/* $NetBSD: netstat.c,v 1.8 1997/10/19 23:36:29 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: netstat.c,v 1.7 1997/07/21 07:05:06 mrg Exp $");
|
||||
__RCSID("$NetBSD: netstat.c,v 1.8 1997/10/19 23:36:29 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -126,7 +126,7 @@ void
|
|||
closenetstat(w)
|
||||
WINDOW *w;
|
||||
{
|
||||
register struct netinfo *p;
|
||||
struct netinfo *p;
|
||||
|
||||
endhostent();
|
||||
endnetent();
|
||||
|
@ -172,8 +172,8 @@ void
|
|||
fetchnetstat()
|
||||
{
|
||||
struct inpcbtable pcbtable;
|
||||
register struct inpcb *head, *prev, *next;
|
||||
register struct netinfo *p;
|
||||
struct inpcb *head, *prev, *next;
|
||||
struct netinfo *p;
|
||||
struct inpcb inpcb;
|
||||
struct socket sockb;
|
||||
struct tcpcb tcpcb;
|
||||
|
@ -240,7 +240,7 @@ enter(inp, so, state, proto)
|
|||
int state;
|
||||
char *proto;
|
||||
{
|
||||
register struct netinfo *p;
|
||||
struct netinfo *p;
|
||||
|
||||
/*
|
||||
* Only take exact matches, any sockets with
|
||||
|
@ -308,7 +308,7 @@ labelnetstat()
|
|||
void
|
||||
shownetstat()
|
||||
{
|
||||
register struct netinfo *p, *q;
|
||||
struct netinfo *p, *q;
|
||||
|
||||
/*
|
||||
* First, delete any connections that have gone
|
||||
|
@ -391,7 +391,7 @@ inetprint(in, port, proto)
|
|||
char line[80], *cp;
|
||||
|
||||
sprintf(line, "%.*s.", 16, inetname(*in));
|
||||
cp = index(line, '\0');
|
||||
cp = strchr(line, '\0');
|
||||
if (!nflag && port)
|
||||
sp = getservbyport(port, proto);
|
||||
if (sp || port == 0)
|
||||
|
@ -399,7 +399,7 @@ inetprint(in, port, proto)
|
|||
else
|
||||
sprintf(cp, "%d", ntohs((u_short)port));
|
||||
/* pad to full column to clear any garbage */
|
||||
cp = index(line, '\0');
|
||||
cp = strchr(line, '\0');
|
||||
while (cp - line < 22)
|
||||
*cp++ = ' ';
|
||||
*cp = '\0';
|
||||
|
@ -452,7 +452,7 @@ int
|
|||
cmdnetstat(cmd, args)
|
||||
char *cmd, *args;
|
||||
{
|
||||
register struct netinfo *p;
|
||||
struct netinfo *p;
|
||||
|
||||
if (prefix(cmd, "all")) {
|
||||
aflag = !aflag;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pigs.c,v 1.6 1997/07/21 07:05:07 mrg Exp $ */
|
||||
/* $NetBSD: pigs.c,v 1.7 1997/10/19 23:36:31 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: pigs.c,v 1.6 1997/07/21 07:05:07 mrg Exp $");
|
||||
__RCSID("$NetBSD: pigs.c,v 1.7 1997/10/19 23:36:31 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -95,7 +95,7 @@ closepigs(w)
|
|||
void
|
||||
showpigs()
|
||||
{
|
||||
register int i, j, y, k;
|
||||
int i, j, y, k;
|
||||
struct eproc *ep;
|
||||
float total;
|
||||
int factor;
|
||||
|
@ -179,10 +179,10 @@ initpigs()
|
|||
void
|
||||
fetchpigs()
|
||||
{
|
||||
register int i;
|
||||
register float time;
|
||||
register struct proc *pp;
|
||||
register float *pctp;
|
||||
int i;
|
||||
float time;
|
||||
struct proc *pp;
|
||||
float *pctp;
|
||||
struct kinfo_proc *kpp;
|
||||
long ctime[CPUSTATES];
|
||||
double t;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: systat.1,v 1.8 1997/07/25 01:59:42 mrg Exp $
|
||||
.\" $NetBSD: systat.1,v 1.9 1997/10/19 23:36:32 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1985, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -40,20 +40,20 @@
|
|||
.Nm systat
|
||||
.Nd display system statistics on a crt
|
||||
.Sh SYNOPSIS
|
||||
.Nm systat
|
||||
.Nm
|
||||
.Op Fl M Ar core
|
||||
.Op Fl N Ar system
|
||||
.Op Fl w Ar wait
|
||||
.Op Ar display
|
||||
.Op Ar refresh-interval
|
||||
.Sh DESCRIPTION
|
||||
.Nm Systat
|
||||
.Nm
|
||||
displays various system statistics in a screen oriented fashion
|
||||
using the curses screen display library,
|
||||
.Xr curses 3 .
|
||||
.Pp
|
||||
While
|
||||
.Nm systat
|
||||
.Nm
|
||||
is running the screen is usually divided into two windows (an exception
|
||||
is the vmstat display which uses the entire screen). The
|
||||
upper window depicts the current system load average. The
|
||||
|
@ -62,7 +62,7 @@ user commands. The last line on the screen is reserved for user
|
|||
input and error messages.
|
||||
.Pp
|
||||
By default
|
||||
.Nm systat
|
||||
.Nm
|
||||
displays the processes getting the largest percentage of the processor
|
||||
in the lower window. Other displays show swap space usage, disk
|
||||
.Tn I/O
|
||||
|
@ -116,7 +116,7 @@ flag.
|
|||
.El
|
||||
.Pp
|
||||
Certain characters cause immediate action by
|
||||
.Nm systat .
|
||||
.Nm "" .
|
||||
These are
|
||||
.Bl -tag -width Fl
|
||||
.It Ic \&^L
|
||||
|
@ -126,7 +126,7 @@ Print the name of the current ``display'' being shown in
|
|||
the lower window and the refresh interval.
|
||||
.It Ic \&^Z
|
||||
Stop
|
||||
.Nm systat .
|
||||
.Nm "" .
|
||||
.It Ic \&:
|
||||
Move the cursor to the command line and interpret the input
|
||||
line typed as a command. While entering a command the
|
||||
|
@ -155,7 +155,7 @@ Supplying only a number will set the refresh interval to this
|
|||
value.
|
||||
.It Ic quit
|
||||
Exit
|
||||
.Nm systat .
|
||||
.Nm "" .
|
||||
(This may be abbreviated to
|
||||
.Ic q . )
|
||||
.El
|
||||
|
@ -416,12 +416,13 @@ For port names.
|
|||
.El
|
||||
.Sh NOTES
|
||||
Much of the information that
|
||||
.Nm systat vmstat
|
||||
.Nm
|
||||
.Ic vmstat
|
||||
uses is obtained from
|
||||
.Cm struct vmmeter cnt .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm systat
|
||||
.Nm
|
||||
program appeared in
|
||||
.Bx 4.3 .
|
||||
.Sh BUGS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vmstat.c,v 1.9 1997/08/25 19:32:01 kleink Exp $ */
|
||||
/* $NetBSD: vmstat.c,v 1.10 1997/10/19 23:36:34 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1983, 1989, 1992, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
|
||||
#endif
|
||||
__RCSID("$NetBSD: vmstat.c,v 1.9 1997/08/25 19:32:01 kleink Exp $");
|
||||
__RCSID("$NetBSD: vmstat.c,v 1.10 1997/10/19 23:36:34 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -265,7 +265,7 @@ fetchkre()
|
|||
void
|
||||
labelkre()
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
clear();
|
||||
mvprintw(STATROW, STATCOL + 4, "users Load");
|
||||
|
@ -524,7 +524,7 @@ cmdkre(cmd, args)
|
|||
static int
|
||||
ucount()
|
||||
{
|
||||
register int nusers = 0;
|
||||
int nusers = 0;
|
||||
|
||||
if (ut < 0)
|
||||
return (0);
|
||||
|
@ -541,7 +541,7 @@ cputime(indx)
|
|||
int indx;
|
||||
{
|
||||
double t;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
t = 0;
|
||||
for (i = 0; i < CPUSTATES; i++)
|
||||
|
@ -613,7 +613,7 @@ getinfo(s, st)
|
|||
mib[1] = VM_METER;
|
||||
if (sysctl(mib, 2, &s->Total, &size, NULL, 0) < 0) {
|
||||
error("Can't get kernel info: %s\n", strerror(errno));
|
||||
bzero(&s->Total, sizeof(s->Total));
|
||||
memset(&s->Total, 0, sizeof(s->Total));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -629,13 +629,13 @@ allocinfo(s)
|
|||
|
||||
static void
|
||||
copyinfo(from, to)
|
||||
register struct Info *from, *to;
|
||||
struct Info *from, *to;
|
||||
{
|
||||
long *intrcnt;
|
||||
|
||||
intrcnt = to->intrcnt;
|
||||
*to = *from;
|
||||
bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (int));
|
||||
memmove(to->intrcnt = intrcnt, from->intrcnt, nintr * sizeof (int));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue