Module Name:    src
Committed By:   riz
Date:           Fri Jan  7 03:57:03 UTC 2011

Modified Files:
        src/external/bsd/top/dist [netbsd-5]: display.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1507):
        external/bsd/top/dist/display.c: revision 1.9
PR/43562: Witold Jan Wnuk: top: CPU percentages overlap labels


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.2 -r1.3.8.3 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.3.8.2 src/external/bsd/top/dist/display.c:1.3.8.3
--- src/external/bsd/top/dist/display.c:1.3.8.2	Sun Nov 21 18:12:24 2010
+++ src/external/bsd/top/dist/display.c	Fri Jan  7 03:57:03 2011
@@ -849,10 +849,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
@@ -1151,10 +1151,10 @@
 
     static char fmttag[100];
 
-    char *short_tag = !multi || ncpu <= 1 ? "CPU: " : "CPU%0*d";
+    char *short_tag = !multi || ncpu <= 1 ? "CPU: " : "CPU%0*d: ";
     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;
     }
 

Reply via email to