Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2011 14:29:05 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218275 - stable/8/contrib/top
Message-ID:  <201102041429.p14ET5u2087152@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Feb  4 14:29:05 2011
New Revision: 218275
URL: http://svn.freebsd.org/changeset/base/218275

Log:
  MFC 218171:
  Output an appropriate amount of padding to line up per-CPU state columns
  rather than using a terminal sequence to move the cursor when drawing the
  initial screen.

Modified:
  stable/8/contrib/top/display.c
Directory Properties:
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)

Modified: stable/8/contrib/top/display.c
==============================================================================
--- stable/8/contrib/top/display.c	Fri Feb  4 14:25:39 2011	(r218274)
+++ stable/8/contrib/top/display.c	Fri Feb  4 14:29:05 2011	(r218275)
@@ -447,12 +447,14 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     /* print tag and bump lastline */
     if (num_cpus == 1)
 	printf("\nCPU: ");
-    else
-	printf("\nCPU %d: ", cpu);
+    else {
+	value = printf("\nCPU %d: ", cpu);
+	while (value++ <= cpustates_column)
+		printf(" ");
+    }
     lastline++;
 
     /* now walk thru the names and print the line */
-    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -532,7 +534,7 @@ z_cpustates()
     register char **names;
     register char *thisname;
     register int *lp;
-    int cpu;
+    int cpu, value;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
     names = cpustate_names;
@@ -540,11 +542,13 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     /* show tag and bump lastline */
     if (num_cpus == 1)
 	printf("\nCPU: ");
-    else
-	printf("\nCPU %d: ", cpu);
+    else {
+	value = printf("\nCPU %d: ", cpu);
+	while (value++ <= cpustates_column)
+		printf(" ");
+    }
     lastline++;
 
-    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102041429.p14ET5u2087152>