Fix whitespace inconsistencies in systat(1).

According to md5(1), the resulting binary is the same.
This commit is contained in:
Ed Schouten 2011-10-15 13:20:36 +00:00
parent 126b36a21e
commit 2bd338d6c4
12 changed files with 131 additions and 131 deletions

View File

@ -47,32 +47,32 @@ static const char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
void
command(const char *cmd)
{
struct cmdtab *p;
char *cp, *tmpstr, *tmpstr1;
struct cmdtab *p;
char *cp, *tmpstr, *tmpstr1;
int interval, omask;
tmpstr = tmpstr1 = strdup(cmd);
omask = sigblock(sigmask(SIGALRM));
for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
;
if (*cp)
*cp++ = '\0';
for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
;
if (*cp)
*cp++ = '\0';
if (*tmpstr1 == '\0')
return;
for (; *cp && isspace(*cp); cp++)
;
if (strcmp(tmpstr1, "quit") == 0 || strcmp(tmpstr1, "q") == 0)
die(0);
if (strcmp(tmpstr1, "quit") == 0 || strcmp(tmpstr1, "q") == 0)
die(0);
if (strcmp(tmpstr1, "load") == 0) {
load();
goto done;
}
if (strcmp(tmpstr1, "stop") == 0) {
alarm(0);
mvaddstr(CMDLINE, 0, "Refresh disabled.");
clrtoeol();
if (strcmp(tmpstr1, "stop") == 0) {
alarm(0);
mvaddstr(CMDLINE, 0, "Refresh disabled.");
clrtoeol();
goto done;
}
}
if (strcmp(tmpstr1, "help") == 0) {
int _col, _len;
@ -89,30 +89,30 @@ command(const char *cmd)
goto done;
}
interval = atoi(tmpstr1);
if (interval <= 0 &&
if (interval <= 0 &&
(strcmp(tmpstr1, "start") == 0 || strcmp(tmpstr1, "interval") == 0)) {
interval = *cp ? atoi(cp) : naptime;
if (interval <= 0) {
if (interval <= 0) {
error("%d: bad interval.", interval);
goto done;
}
}
}
if (interval > 0) {
alarm(0);
naptime = interval;
display(0);
status();
alarm(0);
naptime = interval;
display(0);
status();
goto done;
}
}
p = lookup(tmpstr1);
if (p == (struct cmdtab *)-1) {
error("%s: Ambiguous command.", tmpstr1);
goto done;
}
if (p) {
if (curcmd == p)
if (p) {
if (curcmd == p)
goto done;
alarm(0);
alarm(0);
(*curcmd->c_close)(wnd);
curcmd->c_flags &= ~CF_INIT;
wnd = (*p->c_open)();
@ -131,12 +131,12 @@ command(const char *cmd)
else
goto done;
}
curcmd = p;
curcmd = p;
labels();
display(0);
status();
display(0);
status();
goto done;
}
}
if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp))
error("%s: Unknown command.", tmpstr1);
done:
@ -176,18 +176,18 @@ void
status(void)
{
error("Showing %s, refresh every %d seconds.",
curcmd->c_name, naptime);
error("Showing %s, refresh every %d seconds.",
curcmd->c_name, naptime);
}
int
prefix(const char *s1, const char *s2)
{
while (*s1 == *s2) {
if (*s1 == '\0')
return (1);
s1++, s2++;
}
return (*s1 == '\0');
while (*s1 == *s2) {
if (*s1 == '\0')
return (1);
s1++, s2++;
}
return (*s1 == '\0');
}

View File

@ -40,22 +40,22 @@ static const char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
#include "mode.h"
struct cmdtab cmdtab[] = {
{ "pigs", showpigs, fetchpigs, labelpigs,
{ "pigs", showpigs, fetchpigs, labelpigs,
initpigs, openpigs, closepigs, 0,
0, CF_LOADAV },
{ "swap", showswap, fetchswap, labelswap,
{ "swap", showswap, fetchswap, labelswap,
initswap, openswap, closeswap, 0,
0, CF_LOADAV },
{ "mbufs", showmbufs, fetchmbufs, labelmbufs,
{ "mbufs", showmbufs, fetchmbufs, labelmbufs,
initmbufs, openmbufs, closembufs, 0,
0, CF_LOADAV },
{ "iostat", showiostat, fetchiostat, labeliostat,
{ "iostat", showiostat, fetchiostat, labeliostat,
initiostat, openiostat, closeiostat, cmdiostat,
0, CF_LOADAV },
{ "vmstat", showkre, fetchkre, labelkre,
{ "vmstat", showkre, fetchkre, labelkre,
initkre, openkre, closekre, cmdkre,
0, 0 },
{ "netstat", shownetstat, fetchnetstat, labelnetstat,
{ "netstat", shownetstat, fetchnetstat, labelnetstat,
initnetstat, opennetstat, closenetstat, cmdnetstat,
0, CF_LOADAV },
{ "icmp", showicmp, fetchicmp, labelicmp,
@ -78,6 +78,6 @@ struct cmdtab cmdtab[] = {
{ "ifstat", showifstat, fetchifstat, labelifstat,
initifstat, openifstat, closeifstat, cmdifstat,
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];

View File

@ -43,7 +43,7 @@
#include "extern.h"
#include "convtbl.h"
/* Column numbers */
/* Column numbers */
#define C1 0 /* 0-19 */
#define C2 20 /* 20-39 */
@ -121,9 +121,9 @@ static u_int getifnum(void);
} while (0)
#define DOPUTTOTAL(c, r, d) do { \
CLEAR_COLUMN((r), (c)); \
mvprintw((r), (c), "%12.3f %s ", \
convert(d##_##c, SC_AUTO), \
CLEAR_COLUMN((r), (c)); \
mvprintw((r), (c), "%12.3f %s ", \
convert(d##_##c, SC_AUTO), \
get_string(d##_##c, SC_AUTO)); \
} while (0)
@ -255,8 +255,8 @@ fetchifstat(void)
(void)getifmibdata(ifp->if_row, &ifp->if_mib);
new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
new_outb = ifp->if_mib.ifmd_data.ifi_obytes;
new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
new_outb = ifp->if_mib.ifmd_data.ifi_obytes;
/* Display interface if it's received some traffic. */
if (new_inb > 0 && old_inb == 0) {
@ -269,9 +269,9 @@ fetchifstat(void)
* for our current traffic rates, and while we're there,
* see if we have new peak rates.
*/
old_tv = ifp->tv;
timersub(&new_tv, &old_tv, &tv);
elapsed = tv.tv_sec + (tv.tv_usec * 1e-6);
old_tv = ifp->tv;
timersub(&new_tv, &old_tv, &tv);
elapsed = tv.tv_sec + (tv.tv_usec * 1e-6);
ifp->if_in_curtraffic = new_inb - old_inb;
ifp->if_out_curtraffic = new_outb - old_outb;
@ -281,8 +281,8 @@ fetchifstat(void)
* and line, we divide by ``elapsed'' as this is likely
* to be more accurate.
*/
ifp->if_in_curtraffic /= elapsed;
ifp->if_out_curtraffic /= elapsed;
ifp->if_in_curtraffic /= elapsed;
ifp->if_out_curtraffic /= elapsed;
if (ifp->if_in_curtraffic > ifp->if_in_traffic_peak)
ifp->if_in_traffic_peak = ifp->if_in_curtraffic;

View File

@ -47,76 +47,76 @@ static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
int
keyboard(void)
{
char ch, line[80];
char ch, line[80];
int oldmask;
for (;;) {
col = 0;
move(CMDLINE, 0);
do {
refresh();
ch = getch();
if (ch == ERR) {
if (errno == EINTR)
continue;
exit(1);
}
if (ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
if (col == 0) {
for (;;) {
col = 0;
move(CMDLINE, 0);
do {
refresh();
ch = getch();
if (ch == ERR) {
if (errno == EINTR)
continue;
exit(1);
}
if (ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
if (col == 0) {
#define mask(s) (1 << ((s) - 1))
if (ch == CTRL('l')) {
if (ch == CTRL('l')) {
oldmask = sigblock(mask(SIGALRM));
wrefresh(curscr);
sigsetmask(oldmask);
continue;
}
continue;
}
if (ch == CTRL('g')) {
oldmask = sigblock(mask(SIGALRM));
status();
sigsetmask(oldmask);
continue;
}
if (ch != ':')
continue;
move(CMDLINE, 0);
clrtoeol();
}
if (ch == erasechar() && col > 0) {
if (col == 1 && line[0] == ':')
continue;
col--;
goto doerase;
}
if (ch == CTRL('w') && col > 0) {
while (--col >= 0 && isspace(line[col]))
;
col++;
while (--col >= 0 && !isspace(line[col]))
if (col == 0 && line[0] == ':')
break;
col++;
goto doerase;
}
if (ch == killchar() && col > 0) {
col = 0;
if (line[0] == ':')
col++;
doerase:
move(CMDLINE, col);
clrtoeol();
continue;
}
if (isprint(ch) || ch == ' ') {
line[col] = ch;
mvaddch(CMDLINE, col, ch);
col++;
}
} while (col == 0 || (ch != '\r' && ch != '\n'));
line[col] = '\0';
if (ch != ':')
continue;
move(CMDLINE, 0);
clrtoeol();
}
if (ch == erasechar() && col > 0) {
if (col == 1 && line[0] == ':')
continue;
col--;
goto doerase;
}
if (ch == CTRL('w') && col > 0) {
while (--col >= 0 && isspace(line[col]))
;
col++;
while (--col >= 0 && !isspace(line[col]))
if (col == 0 && line[0] == ':')
break;
col++;
goto doerase;
}
if (ch == killchar() && col > 0) {
col = 0;
if (line[0] == ':')
col++;
doerase:
move(CMDLINE, col);
clrtoeol();
continue;
}
if (isprint(ch) || ch == ' ') {
line[col] = ch;
mvaddch(CMDLINE, col, ch);
col++;
}
} while (col == 0 || (ch != '\r' && ch != '\n'));
line[col] = '\0';
oldmask = sigblock(mask(SIGALRM));
command(line + 1);
command(line + 1);
sigsetmask(oldmask);
}
}
/*NOTREACHED*/
}

View File

@ -128,7 +128,7 @@ closenetstat(WINDOW *w)
lastrow--;
p->ni_line = -1;
}
if (w != NULL) {
if (w != NULL) {
wclear(w);
wrefresh(w);
delwin(w);

View File

@ -33,10 +33,10 @@
#include <curses.h>
struct cmdtab {
const char *c_name; /* command name */
void (*c_refresh)(void); /* display refresh */
void (*c_fetch)(void); /* sets up data structures */
void (*c_label)(void); /* label display */
const char *c_name; /* command name */
void (*c_refresh)(void); /* display refresh */
void (*c_fetch)(void); /* sets up data structures */
void (*c_label)(void); /* label display */
int (*c_init)(void); /* initialize namelist, etc. */
WINDOW *(*c_open)(void); /* open display */
void (*c_close)(WINDOW *); /* close display */

View File

@ -854,7 +854,7 @@ dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then)
elapsed_time = now->snap_time - then->snap_time;
} else {
/* 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);
}