[Toybox] [PATCH] fix "vmstat 2"
enh
enh at google.com
Tue Nov 25 17:24:38 PST 2014
The documentation was already correct: "(With no DELAY, prints one
line. With no COUNT, repeats until killed.)".
diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c
index 49c7cc7..510b3b6 100644
--- a/toys/other/vmstat.c
+++ b/toys/other/vmstat.c
@@ -74,7 +74,7 @@ error:
void vmstat_main(void)
{
struct vmstat_proc top[2];
- int i, loop_delay = 0, loop_max = 0;
+ int i, loop_delay = 0, loop_max = INT_MAX;
unsigned loop, rows = (toys.optflags & FLAG_n) ? 0 : 25,
page_kb = sysconf(_SC_PAGESIZE)/1024;
char *headers="r\0b\0swpd\0free\0buff\0cache\0si\0so\0bi\0bo\0in\0cs\0us\0"
@@ -82,6 +82,7 @@ void vmstat_main(void)
memset(top, 0, sizeof(top));
if (toys.optc) loop_delay = atolx_range(toys.optargs[0], 0, INT_MAX);
+ else loop_max = 1;
if (toys.optc > 1) loop_max = atolx_range(toys.optargs[1], 1, INT_MAX) - 1;
for (loop = 0; loop <= loop_max; loop++) {
1416965078.0
More information about the Toybox
mailing list