From owner-svn-src-all@FreeBSD.ORG Fri Feb 4 14:25:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B2EF106564A; Fri, 4 Feb 2011 14:25:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 293318FC17; Fri, 4 Feb 2011 14:25:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14EPejV087025; Fri, 4 Feb 2011 14:25:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14EPeLY087023; Fri, 4 Feb 2011 14:25:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201102041425.p14EPeLY087023@svn.freebsd.org> From: John Baldwin Date: Fri, 4 Feb 2011 14:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218274 - stable/7/contrib/top X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2011 14:25:40 -0000 Author: jhb Date: Fri Feb 4 14:25:39 2011 New Revision: 218274 URL: http://svn.freebsd.org/changeset/base/218274 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/7/contrib/top/display.c Directory Properties: stable/7/contrib/top/ (props changed) Modified: stable/7/contrib/top/display.c ============================================================================== --- stable/7/contrib/top/display.c Fri Feb 4 14:20:27 2011 (r218273) +++ stable/7/contrib/top/display.c Fri Feb 4 14:25:39 2011 (r218274) @@ -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')