cvs commit: src/usr.bin/systat devs.c vmstat.c
Pawel Jakub Dawidek
nick at garage.freebsd.pl
Tue Oct 21 00:46:24 PDT 2003
On Mon, Oct 20, 2003 at 01:13:51PM -0700, Poul-Henning Kamp wrote:
+> Commiter: Poul-Henning Kamp <phk at FreeBSD.org>
+> Branch: HEAD
+>
+> Files:
+> 1.9 src/usr.bin/systat/devs.c
+> 1.58 src/usr.bin/systat/vmstat.c
+>
+> Log:
+> When a numeric field overflows its width, try formatting the number in
+> 'kilo' or 'mega' with appropriate suffix instead of filling the field
+> with stars.
[...]
+> @@ -678,11 +678,10 @@ putint(n, l, lc, w)
+> return;
+> }
+> snprintf(b, sizeof(b), "%*d", w, n);
+> - if ((int)strlen(b) > w) {
+> - while (w-- > 0)
+> - addch('*');
+> - return;
+> - }
+> + if ((int)strlen(b) > w)
+> + snprintf(b, sizeof(b), "%*dK", w - 1, n / 1000);
+> + if ((int)strlen(b) > w)
+> + snprintf(b, sizeof(b), "%*dM", w - 1, n / 1000000);
+> addstr(b);
+> }
'Kilo' is lowercase 'k':)
--
Pawel Jakub Dawidek pawel at dawidek.net
UNIX Systems Programmer/Administrator http://garage.freebsd.pl
Am I Evil? Yes, I Am! http://cerber.sourceforge.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20031021/c6c58785/attachment.bin
More information about the cvs-src
mailing list