Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/top/dist PR/43562: Witold Jan Wnuk: top: CPU pe...



details:   https://anonhg.NetBSD.org/src/rev/f4c8e50dca8b
branches:  trunk
changeset: 756025:f4c8e50dca8b
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jul 03 13:18:57 2010 +0000

description:
PR/43562: Witold Jan Wnuk: top: CPU percentages overlap labels

diffstat:

 external/bsd/top/dist/display.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 685a5c0a1d9d -r f4c8e50dca8b external/bsd/top/dist/display.c
--- a/external/bsd/top/dist/display.c   Sat Jul 03 12:23:04 2010 +0000
+++ b/external/bsd/top/dist/display.c   Sat Jul 03 13:18:57 2010 +0000
@@ -854,10 +854,10 @@
            *ip++ = cpustate_total_length;
            if ((i = strlen(*pp++)) > 0)
            {
-               cpustate_total_length += i + 7;
-               /* strlen(" 100% ") is 6, strlen(" 99.9% ") is 7. Never 8. */
+               cpustate_total_length += i + 8;
            }
        }
+       cpustate_total_length -= 2;
     }
 
 #ifdef ENABLE_COLOR
@@ -1155,11 +1155,11 @@
 
     static char fmttag[100];
 
-    const char *short_tag = !multi || ncpu <= 1 ? "CPU: " : "CPU%0*d";
+    const char *short_tag = !multi || ncpu <= 1 ? "CPU: " : "CPU%0*d: ";
     const char *long_tag = !multi || ncpu <= 1 ?
        "CPU states: " : "CPU%0*d states: ";
 
-    for (width=0, u=ncpu; u>0; u /= 10) {
+    for (width = 0, u = ncpu - 1; u > 0; u /= 10) {
        ++width;
     }
     /* if length + strlen(long_tag) > screen_width, then we have to



Home | Main Index | Thread Index | Old Index