Fix whitespace inconsistencies in systat(1).
According to md5(1), the resulting binary is the same.
This commit is contained in:
parent
126b36a21e
commit
2bd338d6c4
@ -47,32 +47,32 @@ static const char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
|
|||||||
void
|
void
|
||||||
command(const char *cmd)
|
command(const char *cmd)
|
||||||
{
|
{
|
||||||
struct cmdtab *p;
|
struct cmdtab *p;
|
||||||
char *cp, *tmpstr, *tmpstr1;
|
char *cp, *tmpstr, *tmpstr1;
|
||||||
int interval, omask;
|
int interval, omask;
|
||||||
|
|
||||||
tmpstr = tmpstr1 = strdup(cmd);
|
tmpstr = tmpstr1 = strdup(cmd);
|
||||||
omask = sigblock(sigmask(SIGALRM));
|
omask = sigblock(sigmask(SIGALRM));
|
||||||
for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
|
for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
|
||||||
;
|
;
|
||||||
if (*cp)
|
if (*cp)
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
if (*tmpstr1 == '\0')
|
if (*tmpstr1 == '\0')
|
||||||
return;
|
return;
|
||||||
for (; *cp && isspace(*cp); cp++)
|
for (; *cp && isspace(*cp); cp++)
|
||||||
;
|
;
|
||||||
if (strcmp(tmpstr1, "quit") == 0 || strcmp(tmpstr1, "q") == 0)
|
if (strcmp(tmpstr1, "quit") == 0 || strcmp(tmpstr1, "q") == 0)
|
||||||
die(0);
|
die(0);
|
||||||
if (strcmp(tmpstr1, "load") == 0) {
|
if (strcmp(tmpstr1, "load") == 0) {
|
||||||
load();
|
load();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (strcmp(tmpstr1, "stop") == 0) {
|
if (strcmp(tmpstr1, "stop") == 0) {
|
||||||
alarm(0);
|
alarm(0);
|
||||||
mvaddstr(CMDLINE, 0, "Refresh disabled.");
|
mvaddstr(CMDLINE, 0, "Refresh disabled.");
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (strcmp(tmpstr1, "help") == 0) {
|
if (strcmp(tmpstr1, "help") == 0) {
|
||||||
int _col, _len;
|
int _col, _len;
|
||||||
|
|
||||||
@ -89,30 +89,30 @@ command(const char *cmd)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
interval = atoi(tmpstr1);
|
interval = atoi(tmpstr1);
|
||||||
if (interval <= 0 &&
|
if (interval <= 0 &&
|
||||||
(strcmp(tmpstr1, "start") == 0 || strcmp(tmpstr1, "interval") == 0)) {
|
(strcmp(tmpstr1, "start") == 0 || strcmp(tmpstr1, "interval") == 0)) {
|
||||||
interval = *cp ? atoi(cp) : naptime;
|
interval = *cp ? atoi(cp) : naptime;
|
||||||
if (interval <= 0) {
|
if (interval <= 0) {
|
||||||
error("%d: bad interval.", interval);
|
error("%d: bad interval.", interval);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (interval > 0) {
|
if (interval > 0) {
|
||||||
alarm(0);
|
alarm(0);
|
||||||
naptime = interval;
|
naptime = interval;
|
||||||
display(0);
|
display(0);
|
||||||
status();
|
status();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
p = lookup(tmpstr1);
|
p = lookup(tmpstr1);
|
||||||
if (p == (struct cmdtab *)-1) {
|
if (p == (struct cmdtab *)-1) {
|
||||||
error("%s: Ambiguous command.", tmpstr1);
|
error("%s: Ambiguous command.", tmpstr1);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
if (curcmd == p)
|
if (curcmd == p)
|
||||||
goto done;
|
goto done;
|
||||||
alarm(0);
|
alarm(0);
|
||||||
(*curcmd->c_close)(wnd);
|
(*curcmd->c_close)(wnd);
|
||||||
curcmd->c_flags &= ~CF_INIT;
|
curcmd->c_flags &= ~CF_INIT;
|
||||||
wnd = (*p->c_open)();
|
wnd = (*p->c_open)();
|
||||||
@ -131,12 +131,12 @@ command(const char *cmd)
|
|||||||
else
|
else
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
curcmd = p;
|
curcmd = p;
|
||||||
labels();
|
labels();
|
||||||
display(0);
|
display(0);
|
||||||
status();
|
status();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp))
|
if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp))
|
||||||
error("%s: Unknown command.", tmpstr1);
|
error("%s: Unknown command.", tmpstr1);
|
||||||
done:
|
done:
|
||||||
@ -176,18 +176,18 @@ void
|
|||||||
status(void)
|
status(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
error("Showing %s, refresh every %d seconds.",
|
error("Showing %s, refresh every %d seconds.",
|
||||||
curcmd->c_name, naptime);
|
curcmd->c_name, naptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
prefix(const char *s1, const char *s2)
|
prefix(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (*s1 == *s2) {
|
while (*s1 == *s2) {
|
||||||
if (*s1 == '\0')
|
if (*s1 == '\0')
|
||||||
return (1);
|
return (1);
|
||||||
s1++, s2++;
|
s1++, s2++;
|
||||||
}
|
}
|
||||||
return (*s1 == '\0');
|
return (*s1 == '\0');
|
||||||
}
|
}
|
||||||
|
@ -40,22 +40,22 @@ static const char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
|
|
||||||
struct cmdtab cmdtab[] = {
|
struct cmdtab cmdtab[] = {
|
||||||
{ "pigs", showpigs, fetchpigs, labelpigs,
|
{ "pigs", showpigs, fetchpigs, labelpigs,
|
||||||
initpigs, openpigs, closepigs, 0,
|
initpigs, openpigs, closepigs, 0,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ "swap", showswap, fetchswap, labelswap,
|
{ "swap", showswap, fetchswap, labelswap,
|
||||||
initswap, openswap, closeswap, 0,
|
initswap, openswap, closeswap, 0,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ "mbufs", showmbufs, fetchmbufs, labelmbufs,
|
{ "mbufs", showmbufs, fetchmbufs, labelmbufs,
|
||||||
initmbufs, openmbufs, closembufs, 0,
|
initmbufs, openmbufs, closembufs, 0,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ "iostat", showiostat, fetchiostat, labeliostat,
|
{ "iostat", showiostat, fetchiostat, labeliostat,
|
||||||
initiostat, openiostat, closeiostat, cmdiostat,
|
initiostat, openiostat, closeiostat, cmdiostat,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ "vmstat", showkre, fetchkre, labelkre,
|
{ "vmstat", showkre, fetchkre, labelkre,
|
||||||
initkre, openkre, closekre, cmdkre,
|
initkre, openkre, closekre, cmdkre,
|
||||||
0, 0 },
|
0, 0 },
|
||||||
{ "netstat", shownetstat, fetchnetstat, labelnetstat,
|
{ "netstat", shownetstat, fetchnetstat, labelnetstat,
|
||||||
initnetstat, opennetstat, closenetstat, cmdnetstat,
|
initnetstat, opennetstat, closenetstat, cmdnetstat,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ "icmp", showicmp, fetchicmp, labelicmp,
|
{ "icmp", showicmp, fetchicmp, labelicmp,
|
||||||
@ -78,6 +78,6 @@ struct cmdtab cmdtab[] = {
|
|||||||
{ "ifstat", showifstat, fetchifstat, labelifstat,
|
{ "ifstat", showifstat, fetchifstat, labelifstat,
|
||||||
initifstat, openifstat, closeifstat, cmdifstat,
|
initifstat, openifstat, closeifstat, cmdifstat,
|
||||||
0, CF_LOADAV },
|
0, CF_LOADAV },
|
||||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 }
|
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
struct cmdtab *curcmd = &cmdtab[0];
|
struct cmdtab *curcmd = &cmdtab[0];
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
#include "convtbl.h"
|
#include "convtbl.h"
|
||||||
|
|
||||||
/* Column numbers */
|
/* Column numbers */
|
||||||
|
|
||||||
#define C1 0 /* 0-19 */
|
#define C1 0 /* 0-19 */
|
||||||
#define C2 20 /* 20-39 */
|
#define C2 20 /* 20-39 */
|
||||||
@ -121,9 +121,9 @@ static u_int getifnum(void);
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DOPUTTOTAL(c, r, d) do { \
|
#define DOPUTTOTAL(c, r, d) do { \
|
||||||
CLEAR_COLUMN((r), (c)); \
|
CLEAR_COLUMN((r), (c)); \
|
||||||
mvprintw((r), (c), "%12.3f %s ", \
|
mvprintw((r), (c), "%12.3f %s ", \
|
||||||
convert(d##_##c, SC_AUTO), \
|
convert(d##_##c, SC_AUTO), \
|
||||||
get_string(d##_##c, SC_AUTO)); \
|
get_string(d##_##c, SC_AUTO)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -255,8 +255,8 @@ fetchifstat(void)
|
|||||||
(void)getifmibdata(ifp->if_row, &ifp->if_mib);
|
(void)getifmibdata(ifp->if_row, &ifp->if_mib);
|
||||||
|
|
||||||
|
|
||||||
new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
|
new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
|
||||||
new_outb = ifp->if_mib.ifmd_data.ifi_obytes;
|
new_outb = ifp->if_mib.ifmd_data.ifi_obytes;
|
||||||
|
|
||||||
/* Display interface if it's received some traffic. */
|
/* Display interface if it's received some traffic. */
|
||||||
if (new_inb > 0 && old_inb == 0) {
|
if (new_inb > 0 && old_inb == 0) {
|
||||||
@ -269,9 +269,9 @@ fetchifstat(void)
|
|||||||
* for our current traffic rates, and while we're there,
|
* for our current traffic rates, and while we're there,
|
||||||
* see if we have new peak rates.
|
* see if we have new peak rates.
|
||||||
*/
|
*/
|
||||||
old_tv = ifp->tv;
|
old_tv = ifp->tv;
|
||||||
timersub(&new_tv, &old_tv, &tv);
|
timersub(&new_tv, &old_tv, &tv);
|
||||||
elapsed = tv.tv_sec + (tv.tv_usec * 1e-6);
|
elapsed = tv.tv_sec + (tv.tv_usec * 1e-6);
|
||||||
|
|
||||||
ifp->if_in_curtraffic = new_inb - old_inb;
|
ifp->if_in_curtraffic = new_inb - old_inb;
|
||||||
ifp->if_out_curtraffic = new_outb - old_outb;
|
ifp->if_out_curtraffic = new_outb - old_outb;
|
||||||
@ -281,8 +281,8 @@ fetchifstat(void)
|
|||||||
* and line, we divide by ``elapsed'' as this is likely
|
* and line, we divide by ``elapsed'' as this is likely
|
||||||
* to be more accurate.
|
* to be more accurate.
|
||||||
*/
|
*/
|
||||||
ifp->if_in_curtraffic /= elapsed;
|
ifp->if_in_curtraffic /= elapsed;
|
||||||
ifp->if_out_curtraffic /= elapsed;
|
ifp->if_out_curtraffic /= elapsed;
|
||||||
|
|
||||||
if (ifp->if_in_curtraffic > ifp->if_in_traffic_peak)
|
if (ifp->if_in_curtraffic > ifp->if_in_traffic_peak)
|
||||||
ifp->if_in_traffic_peak = ifp->if_in_curtraffic;
|
ifp->if_in_traffic_peak = ifp->if_in_curtraffic;
|
||||||
|
@ -47,76 +47,76 @@ static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
|
|||||||
int
|
int
|
||||||
keyboard(void)
|
keyboard(void)
|
||||||
{
|
{
|
||||||
char ch, line[80];
|
char ch, line[80];
|
||||||
int oldmask;
|
int oldmask;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
col = 0;
|
col = 0;
|
||||||
move(CMDLINE, 0);
|
move(CMDLINE, 0);
|
||||||
do {
|
do {
|
||||||
refresh();
|
refresh();
|
||||||
ch = getch();
|
ch = getch();
|
||||||
if (ch == ERR) {
|
if (ch == ERR) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (ch >= 'A' && ch <= 'Z')
|
if (ch >= 'A' && ch <= 'Z')
|
||||||
ch += 'a' - 'A';
|
ch += 'a' - 'A';
|
||||||
if (col == 0) {
|
if (col == 0) {
|
||||||
#define mask(s) (1 << ((s) - 1))
|
#define mask(s) (1 << ((s) - 1))
|
||||||
if (ch == CTRL('l')) {
|
if (ch == CTRL('l')) {
|
||||||
oldmask = sigblock(mask(SIGALRM));
|
oldmask = sigblock(mask(SIGALRM));
|
||||||
wrefresh(curscr);
|
wrefresh(curscr);
|
||||||
sigsetmask(oldmask);
|
sigsetmask(oldmask);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ch == CTRL('g')) {
|
if (ch == CTRL('g')) {
|
||||||
oldmask = sigblock(mask(SIGALRM));
|
oldmask = sigblock(mask(SIGALRM));
|
||||||
status();
|
status();
|
||||||
sigsetmask(oldmask);
|
sigsetmask(oldmask);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ch != ':')
|
if (ch != ':')
|
||||||
continue;
|
continue;
|
||||||
move(CMDLINE, 0);
|
move(CMDLINE, 0);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
}
|
}
|
||||||
if (ch == erasechar() && col > 0) {
|
if (ch == erasechar() && col > 0) {
|
||||||
if (col == 1 && line[0] == ':')
|
if (col == 1 && line[0] == ':')
|
||||||
continue;
|
continue;
|
||||||
col--;
|
col--;
|
||||||
goto doerase;
|
goto doerase;
|
||||||
}
|
}
|
||||||
if (ch == CTRL('w') && col > 0) {
|
if (ch == CTRL('w') && col > 0) {
|
||||||
while (--col >= 0 && isspace(line[col]))
|
while (--col >= 0 && isspace(line[col]))
|
||||||
;
|
;
|
||||||
col++;
|
col++;
|
||||||
while (--col >= 0 && !isspace(line[col]))
|
while (--col >= 0 && !isspace(line[col]))
|
||||||
if (col == 0 && line[0] == ':')
|
if (col == 0 && line[0] == ':')
|
||||||
break;
|
break;
|
||||||
col++;
|
col++;
|
||||||
goto doerase;
|
goto doerase;
|
||||||
}
|
}
|
||||||
if (ch == killchar() && col > 0) {
|
if (ch == killchar() && col > 0) {
|
||||||
col = 0;
|
col = 0;
|
||||||
if (line[0] == ':')
|
if (line[0] == ':')
|
||||||
col++;
|
col++;
|
||||||
doerase:
|
doerase:
|
||||||
move(CMDLINE, col);
|
move(CMDLINE, col);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isprint(ch) || ch == ' ') {
|
if (isprint(ch) || ch == ' ') {
|
||||||
line[col] = ch;
|
line[col] = ch;
|
||||||
mvaddch(CMDLINE, col, ch);
|
mvaddch(CMDLINE, col, ch);
|
||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
} while (col == 0 || (ch != '\r' && ch != '\n'));
|
} while (col == 0 || (ch != '\r' && ch != '\n'));
|
||||||
line[col] = '\0';
|
line[col] = '\0';
|
||||||
oldmask = sigblock(mask(SIGALRM));
|
oldmask = sigblock(mask(SIGALRM));
|
||||||
command(line + 1);
|
command(line + 1);
|
||||||
sigsetmask(oldmask);
|
sigsetmask(oldmask);
|
||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ closenetstat(WINDOW *w)
|
|||||||
lastrow--;
|
lastrow--;
|
||||||
p->ni_line = -1;
|
p->ni_line = -1;
|
||||||
}
|
}
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
wclear(w);
|
wclear(w);
|
||||||
wrefresh(w);
|
wrefresh(w);
|
||||||
delwin(w);
|
delwin(w);
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
|
|
||||||
struct cmdtab {
|
struct cmdtab {
|
||||||
const char *c_name; /* command name */
|
const char *c_name; /* command name */
|
||||||
void (*c_refresh)(void); /* display refresh */
|
void (*c_refresh)(void); /* display refresh */
|
||||||
void (*c_fetch)(void); /* sets up data structures */
|
void (*c_fetch)(void); /* sets up data structures */
|
||||||
void (*c_label)(void); /* label display */
|
void (*c_label)(void); /* label display */
|
||||||
int (*c_init)(void); /* initialize namelist, etc. */
|
int (*c_init)(void); /* initialize namelist, etc. */
|
||||||
WINDOW *(*c_open)(void); /* open display */
|
WINDOW *(*c_open)(void); /* open display */
|
||||||
void (*c_close)(WINDOW *); /* close display */
|
void (*c_close)(WINDOW *); /* close display */
|
||||||
|
@ -854,7 +854,7 @@ dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then)
|
|||||||
elapsed_time = now->snap_time - then->snap_time;
|
elapsed_time = now->snap_time - then->snap_time;
|
||||||
} else {
|
} else {
|
||||||
/* Calculate relative to device creation */
|
/* Calculate relative to device creation */
|
||||||
elapsed_time = now->snap_time - devstat_compute_etime(
|
elapsed_time = now->snap_time - devstat_compute_etime(
|
||||||
&now->dinfo->devices[di].creation_time, NULL);
|
&now->dinfo->devices[di].creation_time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user