summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-12-23 17:02:09 +0000
committeryar <yar@FreeBSD.org>2006-12-23 17:02:09 +0000
commitf5202f68c17e07ac5c4f11c34f720eda6250dbda (patch)
treee2aa195761258a61a70bd1c33fc0ef9d1fb5afca /usr.bin/systat
parentaa4002fd1ac738787f67fcc82805387acc36e322 (diff)
downloadFreeBSD-src-f5202f68c17e07ac5c4f11c34f720eda6250dbda.zip
FreeBSD-src-f5202f68c17e07ac5c4f11c34f720eda6250dbda.tar.gz
Improve style:
- Don't define vars inside loops. - Avoid useless casts. - Use C idioms. - Do alike things in a consistent way.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/swap.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
index 880ebea..b9ec856 100644
--- a/usr.bin/systat/swap.c
+++ b/usr.bin/systat/swap.c
@@ -159,14 +159,13 @@ labelswap()
void
showswap()
{
+ int count;
int i;
if (kvnsw != okvnsw || ulen != oulen)
labelswap();
for (i = 0; i <= kvnsw; ++i) {
- int count;
-
if (i == kvnsw) {
if (kvnsw == 1)
break;
@@ -184,26 +183,13 @@ showswap()
wmove(wnd, i + 1, 5);
- wprintw(
- wnd,
- "%*d",
- hlen,
- CONVERT(kvmsw[i].ksw_total)
- );
-
- wprintw(
- wnd,
- "%*d ",
- ulen,
- CONVERT(kvmsw[i].ksw_used)
- );
+ wprintw(wnd, "%*d", hlen, CONVERT(kvmsw[i].ksw_total));
+ wprintw(wnd, "%*d", ulen, CONVERT(kvmsw[i].ksw_used));
- count = (int)((double)kvmsw[i].ksw_used * 49.999 /
- (double)kvmsw[i].ksw_total);
+ count = (double)kvmsw[i].ksw_used * 49.999 / kvmsw[i].ksw_total;
- while (count >= 0) {
+ waddch(wnd, ' ');
+ while (count--)
waddch(wnd, 'X');
- --count;
- }
}
}
OpenPOWER on IntegriCloud