Module Name:    src
Committed By:   christos
Date:           Sat Jul  3 13:18:57 UTC 2010

Modified Files:
        src/external/bsd/top/dist: display.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/top/dist/display.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/display.c
diff -u src/external/bsd/top/dist/display.c:1.8 src/external/bsd/top/dist/display.c:1.9
--- src/external/bsd/top/dist/display.c:1.8	Wed Jun 30 07:08:12 2010
+++ src/external/bsd/top/dist/display.c	Sat Jul  3 09:18:57 2010
@@ -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

Reply via email to