summaryrefslogtreecommitdiffstats
path: root/contrib/top/display.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-02-01 15:48:27 +0000
committerjhb <jhb@FreeBSD.org>2011-02-01 15:48:27 +0000
commiteb4f6eac7b9dc5ea895bdf5b635478230c74f482 (patch)
treec875155b8c1b6978957e8e6c3378ad024f182ef5 /contrib/top/display.c
parente42de5418c3f0135f610990e2649f1d29613cec9 (diff)
downloadFreeBSD-src-eb4f6eac7b9dc5ea895bdf5b635478230c74f482.zip
FreeBSD-src-eb4f6eac7b9dc5ea895bdf5b635478230c74f482.tar.gz
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. Requested by: arundel MFC after: 3 days
Diffstat (limited to 'contrib/top/display.c')
-rw-r--r--contrib/top/display.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/top/display.c b/contrib/top/display.c
index de91c6c..f0f0c23 100644
--- a/contrib/top/display.c
+++ b/contrib/top/display.c
@@ -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')
OpenPOWER on IntegriCloud