summaryrefslogtreecommitdiff
path: root/usr.bin/systat/ifstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/systat/ifstat.c')
-rw-r--r--usr.bin/systat/ifstat.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c
index 16328906832a..4cfe01c4d616 100644
--- a/usr.bin/systat/ifstat.c
+++ b/usr.bin/systat/ifstat.c
@@ -77,7 +77,7 @@ struct if_stat {
u_long if_in_pps_peak;
u_long if_out_pps_peak;
u_int if_row; /* Index into ifmib sysctl */
- u_int if_ypos; /* 0 if not being displayed */
+ int if_ypos; /* -1 if not being displayed */
u_int display;
u_int match;
};
@@ -210,13 +210,19 @@ showifstat(void)
struct if_stat *ifp = NULL;
SLIST_FOREACH(ifp, &curlist, link) {
- if (ifp->display == 0 || (ifp->match == 0) ||
- ifp->if_ypos > LINES - 3 - 1)
- continue;
- PUTNAME(ifp);
- PUTRATE(col2, ifp->if_ypos);
- PUTRATE(col3, ifp->if_ypos);
- PUTTOTAL(col4, ifp->if_ypos);
+ if (ifp->if_ypos < LINES - 3 && ifp->if_ypos != -1)
+ if (ifp->display == 0 || ifp->match == 0) {
+ wmove(wnd, ifp->if_ypos, 0);
+ wclrtoeol(wnd);
+ wmove(wnd, ifp->if_ypos + 1, 0);
+ wclrtoeol(wnd);
+ }
+ else {
+ PUTNAME(ifp);
+ PUTRATE(col2, ifp->if_ypos);
+ PUTRATE(col3, ifp->if_ypos);
+ PUTTOTAL(col4, ifp->if_ypos);
+ }
}
return;
@@ -425,6 +431,8 @@ sort_interface_list(void)
ifp->if_ypos = y;
y += ROW_SPACING;
}
+ else
+ ifp->if_ypos = -1;
}
needsort = 0;
@@ -476,14 +484,13 @@ cmdifstat(const char *cmd, const char *args)
retval = ifcmd(cmd, args);
/* ifcmd() returns 1 on success */
if (retval == 1) {
- showifstat();
- refresh();
if (needclear) {
+ showifstat();
+ refresh();
werase(wnd);
labelifstat();
needclear = 0;
}
}
-
return (retval);
}