Fix whitespace inconsistencies in systat(1).

According to md5(1), the resulting binary is the same.
This commit is contained in:
ed 2011-10-15 13:20:36 +00:00
parent 8e118d38cf
commit 2f1e586900
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

@ -105,7 +105,7 @@ dsinit(int maxshowdevs, struct statinfo *s1, struct statinfo *s2 __unused,
/*
* Make sure that the userland devstat version matches the kernel
* devstat version. If not, exit and print a message informing
* devstat version. If not, exit and print a message informing
* the user of his mistake.
*/
if (devstat_checkversion(NULL) < 0)
@ -155,10 +155,10 @@ dscmd(const char *cmd, const char *args, int maxshowdevs, struct statinfo *s1)
if (prefix(cmd, "refresh")) {
retval = devstat_selectdevs(&dev_select, &num_selected,
&num_selections, &select_generation, generation,
s1->dinfo->devices, num_devices,
s1->dinfo->devices, num_devices,
(last_type ==DS_MATCHTYPE_PATTERN) ? matches : NULL,
(last_type ==DS_MATCHTYPE_PATTERN) ? num_matches : 0,
(last_type == DS_MATCHTYPE_SPEC) ?specified_devices : NULL,
(last_type == DS_MATCHTYPE_SPEC) ?specified_devices : NULL,
(last_type == DS_MATCHTYPE_SPEC) ?num_devices_specified : 0,
(last_type == DS_MATCHTYPE_NONE) ? DS_SELECT_ADD :
DS_SELECT_ADDONLY, maxshowdevs, 0);
@ -220,7 +220,7 @@ dsmatchselect(const char *args, devstat_select_mode select_mode, int maxshowdevs
}
for (i = 0; i < num_args; i++) {
if (devstat_buildmatch(tstr[i], &matches, &num_matches) != 0) {
if (devstat_buildmatch(tstr[i], &matches, &num_matches) != 0) {
warnx("%s", devstat_errbuf);
return(0);
}
@ -282,7 +282,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs,
asprintf(&buffer, "%s%d", dev_select[i].device_name,
dev_select[i].unit_number);
if (strcmp(buffer, tmpstr1) == 0) {
num_devices_specified++;
specified_devices =(char **)realloc(

View File

@ -62,17 +62,17 @@ void getsysctl(const char *name, void *ptr, size_t len)
{
size_t nlen = len;
if (sysctlbyname(name, ptr, &nlen, NULL, 0) != 0) {
error("sysctl(%s...) failed: %s", name,
error("sysctl(%s...) failed: %s", name,
strerror(errno));
}
if (nlen != len) {
error("sysctl(%s...) expected %lu, got %lu", name,
error("sysctl(%s...) expected %lu, got %lu", name,
(unsigned long)len, (unsigned long)nlen);
}
}
/*
* Read sysctl data with variable size. Try some times (with increasing
* Read sysctl data with variable size. Try some times (with increasing
* buffers), fail if still too small.
* This is needed sysctls with possibly raplidly increasing data sizes,
* but imposes little overhead in the case of constant sizes.
@ -84,8 +84,8 @@ void getsysctl(const char *name, void *ptr, size_t len)
/* Some defines: Number of tries. */
#define SD_NTRIES 10
/* Percent of over-allocation (initial) */
#define SD_MARGIN 10
/*
#define SD_MARGIN 10
/*
* Factor for over-allocation in percent (the margin is increased by this on
* any failed try).
*/

View File

@ -47,7 +47,7 @@ ifcmd(const char *cmd, const char *args)
clrtoeol();
addstr("what scale? ");
addstr(get_helplist());
}
}
}
return (1);
}

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

@ -12,7 +12,7 @@
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
*
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

View File

@ -12,7 +12,7 @@
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
*
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

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

@ -224,7 +224,7 @@ initkre(void)
intrloc = calloc(nintr, sizeof (long));
intrname = calloc(nintr, sizeof (char *));
intrnamebuf = sysctl_dynread("hw.intrnames", NULL);
if (intrnamebuf == NULL || intrname == NULL ||
if (intrnamebuf == NULL || intrname == NULL ||
intrloc == NULL) {
error("Out of memory");
if (intrnamebuf)
@ -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);
}