Display floats with format %*.0f instead of as "*****" if there is

enough space for this but not enough space for the normal %*.*f
format.  Similarly for long doubles.
This commit is contained in:
Bruce Evans 1999-03-22 03:44:01 +00:00
parent fc8fc1d234
commit 0af0a4b0f4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44935

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
static const char rcsid[] =
"$Id: vmstat.c,v 1.33 1999/02/08 02:11:52 dillon Exp $";
"$Id: vmstat.c,v 1.34 1999/02/08 02:39:45 dillon Exp $";
#endif /* not lint */
/*
@ -684,6 +684,8 @@ putfloat(f, l, c, w, d, nz)
return;
}
snprintf(b, sizeof(b), "%*.*f", w, d, f);
if (strlen(b) > w)
snprintf(b, sizeof(b), "%*.0f", w, f);
if (strlen(b) > w) {
while (--w >= 0)
addch('*');
@ -706,6 +708,8 @@ putlongdouble(f, l, c, w, d, nz)
return;
}
sprintf(b, "%*.*Lf", w, d, f);
if (strlen(b) > w)
sprintf(b, "%*.0Lf", w, f);
if (strlen(b) > w) {
while (--w >= 0)
addch('*');