From owner-svn-src-all@FreeBSD.ORG Thu Jun 23 01:16:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 2CEAF1065670; Thu, 23 Jun 2011 01:16:33 +0000 (UTC) Date: Thu, 23 Jun 2011 01:16:33 +0000 From: Alexander Best To: Xin LI Message-ID: <20110623011633.GA8035@freebsd.org> References: <201106201648.p5KGm0fp057853@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201106201648.p5KGm0fp057853@svn.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 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: Thu, 23 Jun 2011 01:16:33 -0000 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