From owner-svn-src-all@FreeBSD.ORG Thu Feb 9 15:21:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 619C71065673; Thu, 9 Feb 2012 15:21:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A4648FC0C; Thu, 9 Feb 2012 15:21:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q19FLtAe006946; Thu, 9 Feb 2012 15:21:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q19FLtfA006932; Thu, 9 Feb 2012 15:21:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202091521.q19FLtfA006932@svn.freebsd.org> From: Ed Schouten Date: Thu, 9 Feb 2012 15:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231279 - stable/9/usr.bin/systat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2012 15:21:55 -0000 Author: ed Date: Thu Feb 9 15:21:54 2012 New Revision: 231279 URL: http://svn.freebsd.org/changeset/base/231279 Log: MFC r226396: Fix whitespace inconsistencies in systat(1). According to md5(1), the resulting binary is the same. Modified: stable/9/usr.bin/systat/cmds.c stable/9/usr.bin/systat/cmdtab.c stable/9/usr.bin/systat/devs.c stable/9/usr.bin/systat/fetch.c stable/9/usr.bin/systat/ifcmds.c stable/9/usr.bin/systat/ifstat.c stable/9/usr.bin/systat/keyboard.c stable/9/usr.bin/systat/mode.c stable/9/usr.bin/systat/mode.h stable/9/usr.bin/systat/netstat.c stable/9/usr.bin/systat/systat.h stable/9/usr.bin/systat/vmstat.c Directory Properties: stable/9/usr.bin/systat/ (props changed) Modified: stable/9/usr.bin/systat/cmds.c ============================================================================== --- stable/9/usr.bin/systat/cmds.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/cmds.c Thu Feb 9 15:21:54 2012 (r231279) @@ -47,32 +47,32 @@ static const char sccsid[] = "@(#)cmds.c 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'); } Modified: stable/9/usr.bin/systat/cmdtab.c ============================================================================== --- stable/9/usr.bin/systat/cmdtab.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/cmdtab.c Thu Feb 9 15:21:54 2012 (r231279) @@ -40,22 +40,22 @@ static const char sccsid[] = "@(#)cmdtab #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]; Modified: stable/9/usr.bin/systat/devs.c ============================================================================== --- stable/9/usr.bin/systat/devs.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/devs.c Thu Feb 9 15:21:54 2012 (r231279) @@ -105,7 +105,7 @@ dsinit(int maxshowdevs, struct statinfo /* * 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, 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_ } 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_selec 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( Modified: stable/9/usr.bin/systat/fetch.c ============================================================================== --- stable/9/usr.bin/systat/fetch.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/fetch.c Thu Feb 9 15:21:54 2012 (r231279) @@ -62,17 +62,17 @@ void getsysctl(const char *name, void *p { 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 *p /* 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). */ Modified: stable/9/usr.bin/systat/ifcmds.c ============================================================================== --- stable/9/usr.bin/systat/ifcmds.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/ifcmds.c Thu Feb 9 15:21:54 2012 (r231279) @@ -47,7 +47,7 @@ ifcmd(const char *cmd, const char *args) clrtoeol(); addstr("what scale? "); addstr(get_helplist()); - } + } } return (1); } Modified: stable/9/usr.bin/systat/ifstat.c ============================================================================== --- stable/9/usr.bin/systat/ifstat.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/ifstat.c Thu Feb 9 15:21:54 2012 (r231279) @@ -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; Modified: stable/9/usr.bin/systat/keyboard.c ============================================================================== --- stable/9/usr.bin/systat/keyboard.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/keyboard.c Thu Feb 9 15:21:54 2012 (r231279) @@ -47,76 +47,76 @@ static const char sccsid[] = "@(#)keyboa 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*/ } Modified: stable/9/usr.bin/systat/mode.c ============================================================================== --- stable/9/usr.bin/systat/mode.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/mode.c Thu Feb 9 15:21:54 2012 (r231279) @@ -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 Modified: stable/9/usr.bin/systat/mode.h ============================================================================== --- stable/9/usr.bin/systat/mode.h Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/mode.h Thu Feb 9 15:21:54 2012 (r231279) @@ -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 Modified: stable/9/usr.bin/systat/netstat.c ============================================================================== --- stable/9/usr.bin/systat/netstat.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/netstat.c Thu Feb 9 15:21:54 2012 (r231279) @@ -128,7 +128,7 @@ closenetstat(WINDOW *w) lastrow--; p->ni_line = -1; } - if (w != NULL) { + if (w != NULL) { wclear(w); wrefresh(w); delwin(w); Modified: stable/9/usr.bin/systat/systat.h ============================================================================== --- stable/9/usr.bin/systat/systat.h Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/systat.h Thu Feb 9 15:21:54 2012 (r231279) @@ -33,10 +33,10 @@ #include 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 */ Modified: stable/9/usr.bin/systat/vmstat.c ============================================================================== --- stable/9/usr.bin/systat/vmstat.c Thu Feb 9 14:16:40 2012 (r231278) +++ stable/9/usr.bin/systat/vmstat.c Thu Feb 9 15:21:54 2012 (r231279) @@ -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 *n 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); }