summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2010-11-06 03:59:21 +0000
committerdelphij <delphij@FreeBSD.org>2010-11-06 03:59:21 +0000
commite5ffca4db6145f8a64ad71d245708101d8f06083 (patch)
tree1d56f765850e5614fb3f79630e2fa04534a34c54
parent070520ecc1bf32802f718d73dab306102fd0f0b9 (diff)
downloadFreeBSD-src-e5ffca4db6145f8a64ad71d245708101d8f06083.zip
FreeBSD-src-e5ffca4db6145f8a64ad71d245708101d8f06083.tar.gz
Inverse display of top(1)'s table header when running in inactive mode.
MFC after: 2 weeks
-rw-r--r--contrib/top/display.c12
-rw-r--r--contrib/top/top.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/contrib/top/display.c b/contrib/top/display.c
index 9476530..de91c6c 100644
--- a/contrib/top/display.c
+++ b/contrib/top/display.c
@@ -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)
diff --git a/contrib/top/top.h b/contrib/top/top.h
index a281957..c51485a 100644
--- a/contrib/top/top.h
+++ b/contrib/top/top.h
@@ -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
OpenPOWER on IntegriCloud