From owner-svn-src-head@FreeBSD.ORG Sat Nov 6 03:59:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5027106564A; Sat, 6 Nov 2010 03:59:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A36788FC1F; Sat, 6 Nov 2010 03:59:21 +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 oA63xLAC018364; Sat, 6 Nov 2010 03:59:21 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA63xLED018361; Sat, 6 Nov 2010 03:59:21 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011060359.oA63xLED018361@svn.freebsd.org> From: Xin LI Date: Sat, 6 Nov 2010 03:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214857 - head/contrib/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 03:59:21 -0000 Author: delphij Date: Sat Nov 6 03:59:21 2010 New Revision: 214857 URL: http://svn.freebsd.org/changeset/base/214857 Log: Inverse display of top(1)'s table header when running in inactive mode. MFC after: 2 weeks Modified: head/contrib/top/display.c head/contrib/top/top.h Modified: head/contrib/top/display.c ============================================================================== --- head/contrib/top/display.c Sat Nov 6 01:09:00 2010 (r214856) +++ head/contrib/top/display.c Sat Nov 6 03:59:21 2010 (r214857) @@ -694,7 +694,7 @@ char *text; int width; s = NULL; - width = display_width; + width = screen_width; header_length = strlen(text); if (header_length >= width) { s = malloc((width + 1) * sizeof(char)); @@ -702,6 +702,14 @@ 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); } @@ -726,7 +734,7 @@ char *text; if (header_status == ON) { putchar('\n'); - fputs(text, stdout); + standout(text, stdout); lastline++; } else if (header_status == ERASE) Modified: head/contrib/top/top.h ============================================================================== --- head/contrib/top/top.h Sat Nov 6 01:09:00 2010 (r214856) +++ head/contrib/top/top.h Sat Nov 6 03:59:21 2010 (r214857) @@ -14,7 +14,7 @@ extern int Header_lines; /* 7 */ /* Maximum number of columns allowed for display */ -#define MAX_COLS 128 +#define MAX_COLS 512 /* Log base 2 of 1024 is 10 (2^10 == 1024) */ #define LOG1024 10