Date: Tue, 21 Oct 2003 09:43:26 +0200 From: Pawel Jakub Dawidek <nick@garage.freebsd.pl> To: Poul-Henning Kamp <phk@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/systat devs.c vmstat.c Message-ID: <20031021074326.GZ520@garage.freebsd.pl> In-Reply-To: <200310202013.h9KKDpnr086806@repoman.freebsd.org> References: <200310202013.h9KKDpnr086806@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Mon, Oct 20, 2003 at 01:13:51PM -0700, Poul-Henning Kamp wrote:
+> Commiter: Poul-Henning Kamp <phk@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@dawidek.net
UNIX Systems Programmer/Administrator http://garage.freebsd.pl
Am I Evil? Yes, I Am! http://cerber.sourceforge.net
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iQCVAwUBP5Tjnj/PhmMH/Mf1AQEM/QQApeeGsjDqM/d2x5LDV8WephUkYDcAQmr3
xWkL4t9eVaUlazXmGrWwI7gaFE8ZqafdwB6eqRxaLTH5r+EMmingn3wQ0hUubFk0
PXgvWSONDErnYs4WknxDoRJqbGY8KoC2eeTJpYQpi3mpNGtfu4X+CcWUr38aZEDK
lKSaEjgG1pA=
=sltM
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031021074326.GZ520>
