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
--4BbZpS4xx+iYF6kJ Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 20, 2003 at 01:13:51PM -0700, Poul-Henning Kamp wrote: +> Commiter: Poul-Henning Kamp <phk@FreeBSD.org> +> Branch: HEAD +>=20 +> Files: +> 1.9 src/usr.bin/systat/devs.c =20 +> 1.58 src/usr.bin/systat/vmstat.c =20 +>=20 +> 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':) --=20 Pawel Jakub Dawidek pawel@dawidek.net UNIX Systems Programmer/Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am! http://cerber.sourceforge.net --4BbZpS4xx+iYF6kJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iQCVAwUBP5Tjnj/PhmMH/Mf1AQEM/QQApeeGsjDqM/d2x5LDV8WephUkYDcAQmr3 xWkL4t9eVaUlazXmGrWwI7gaFE8ZqafdwB6eqRxaLTH5r+EMmingn3wQ0hUubFk0 PXgvWSONDErnYs4WknxDoRJqbGY8KoC2eeTJpYQpi3mpNGtfu4X+CcWUr38aZEDK lKSaEjgG1pA= =sltM -----END PGP SIGNATURE----- --4BbZpS4xx+iYF6kJ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031021074326.GZ520>