Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Feb 2011 16:41:27 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r218171 - head/contrib/top
Message-ID:  <20110201164127.GA44442@freebsd.org>
In-Reply-To: <201102011548.p11FmRpN077061@svn.freebsd.org>
References:  <201102011548.p11FmRpN077061@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue Feb  1 11, John Baldwin wrote:
> Author: jhb
> Date: Tue Feb  1 15:48:27 2011
> New Revision: 218171
> URL: http://svn.freebsd.org/changeset/base/218171
> 
> Log:
>   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.

thanks. :)

>   
>   Requested by:	arundel
>   MFC after:	3 days
> 
> Modified:
>   head/contrib/top/display.c
> 
> Modified: head/contrib/top/display.c
> ==============================================================================
> --- head/contrib/top/display.c	Tue Feb  1 15:26:30 2011	(r218170)
> +++ head/contrib/top/display.c	Tue Feb  1 15:48:27 2011	(r218171)
> @@ -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')

-- 
a13x



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