Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jun 2011 01:16:33 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Xin LI <delphij@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r223342 - head/contrib/top
Message-ID:  <20110623011633.GA8035@freebsd.org>
In-Reply-To: <201106201648.p5KGm0fp057853@svn.freebsd.org>
References:  <201106201648.p5KGm0fp057853@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon Jun 20 11, Xin LI wrote:
> Author: delphij
> Date: Mon Jun 20 16:48:00 2011
> New Revision: 223342
> URL: http://svn.freebsd.org/changeset/base/223342
> 
> Log:
>   Revert r214857 pursudant to 9.0-RELEASE cycle.

why does top(1) have so much problems with finding the applicable number of
available columns? ps(1) works great regarding this matter. for me it works
without the need for the -w or -ww switch under the console and under X and
always makes perfect use of the available columns.

i've never been able to make `top -a` display complete commands, although
there defenately are enough columns available.

cheers.
alex

>   
>   Requested by:	jh
> 
> Modified:
>   head/contrib/top/display.c
>   head/contrib/top/top.h
> 
> Modified: head/contrib/top/display.c
> ==============================================================================
> --- head/contrib/top/display.c	Mon Jun 20 16:42:20 2011	(r223341)
> +++ head/contrib/top/display.c	Mon Jun 20 16:48:00 2011	(r223342)
> @@ -698,7 +698,7 @@ char *text;
>  	int width;
>  
>  	s = NULL;
> -	width = screen_width;
> +	width = display_width;
>  	header_length = strlen(text);
>  	if (header_length >= width) {
>  		s = malloc((width + 1) * sizeof(char));
> @@ -706,14 +706,6 @@ char *text;
>  			return (NULL);
>  		strncpy(s, text, width);
>  		s[width] = '\0';
> -	} else {
> -		s = malloc((width + 1) * sizeof(char));
> -		if (s == NULL)
> -			return (NULL);
> -		strncpy(s, text, width);
> -		while (screen_width > header_length)
> -			s[header_length++] = ' ';
> -		s[width] = '\0';
>  	}
>  	return (s);
>  }
> @@ -738,7 +730,7 @@ char *text;
>      if (header_status == ON)
>      {
>  	putchar('\n');
> -	standout(text, stdout);
> +	fputs(text, stdout);
>  	lastline++;
>      }
>      else if (header_status == ERASE)
> 
> Modified: head/contrib/top/top.h
> ==============================================================================
> --- head/contrib/top/top.h	Mon Jun 20 16:42:20 2011	(r223341)
> +++ head/contrib/top/top.h	Mon Jun 20 16:48:00 2011	(r223342)
> @@ -14,7 +14,7 @@
>  extern int Header_lines;	/* 7 */
>  
>  /* Maximum number of columns allowed for display */
> -#define MAX_COLS	512
> +#define MAX_COLS	128
>  
>  /* Log base 2 of 1024 is 10 (2^10 == 1024) */
>  #define LOG1024		10



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