Index: usr.bin/systat/Makefile =================================================================== --- usr.bin/systat/Makefile +++ usr.bin/systat/Makefile @@ -16,6 +16,6 @@ WARNS?= 1 -LIBADD= ncursesw m devstat kvm +LIBADD= ncursesw m devstat kvm util .include Index: usr.bin/systat/vmstat.c =================================================================== --- usr.bin/systat/vmstat.c +++ usr.bin/systat/vmstat.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -135,7 +136,7 @@ static float cputime(int); static void dinfo(int, int, struct statinfo *, struct statinfo *); static void getinfo(struct Info *); -static void putint(int, int, int, int); +static void putint(uint64_t, int, int, int); static void putfloat(double, int, int, int, int, int); static void putlongdouble(long double, int, int, int, int, int); static int ucount(void); @@ -662,10 +663,11 @@ } static void -putint(int n, int l, int lc, int w) +putint(uint64_t n, int l, int lc, int w) { int snr; char b[128]; + char buf[128]; move(l, lc); #ifdef DEBUG @@ -678,11 +680,12 @@ addch(' '); return; } - snr = snprintf(b, sizeof(b), "%*d", w, n); - if (snr != w) - snr = snprintf(b, sizeof(b), "%*dk", w - 1, n / 1000); - if (snr != w) - snr = snprintf(b, sizeof(b), "%*dM", w - 1, n / 1000000); + snr = snprintf(b, sizeof(b), "%*jd", (uintmax_t)w, n); + if (snr != w) { + humanize_number(buf, w, n, "", HN_AUTOSCALE, + HN_NOSPACE | HN_DECIMAL); + snr = snprintf(b, sizeof(b), "%*s", w, buf); + } if (snr != w) { while (w-- > 0) addch('*');