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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to