summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-11-30 10:39:02 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-11-30 10:39:02 +0000
commit3922af80cfc9f34a92680654b011510eb22af2e7 (patch)
treeef5919538566f56a7fc77f67bea883de417d2aa9
parent8fd1c6eb2ab238e76bbdd2a788e6d6ea4492d7d9 (diff)
Simplify process header display logic a bit. From Mark Lumsden
-rw-r--r--usr.bin/top/display.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
index c167ebd57bf..34a2b907bef 100644
--- a/usr.bin/top/display.c
+++ b/usr.bin/top/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.32 2007/11/22 11:01:04 otto Exp $ */
+/* $OpenBSD: display.c,v 1.33 2007/11/30 10:39:01 otto Exp $ */
/*
* Top users/processes display for Unix
@@ -105,9 +105,7 @@ int y_procs;
extern int ncpu;
int Header_lines;
-static enum {
- OFF, ON, ERASE
-} header_status = ON;
+int header_status = Yes;
static int
empty(void)
@@ -444,8 +442,6 @@ i_message(void)
}
}
-static int header_length;
-
/*
* *_header(text) - print the header for the process area
*/
@@ -453,8 +449,7 @@ static int header_length;
void
i_header(char *text)
{
- header_length = strlen(text);
- if (header_status == ON && (screen_length > y_header
+ if (header_status == Yes && (screen_length > y_header
|| !smart_terminal)) {
if (!smart_terminal) {
putn();
@@ -466,8 +461,6 @@ i_header(char *text)
clrtoeol();
addstrp(text);
}
- } else if (header_status == ERASE) {
- header_status = OFF;
}
}
@@ -512,13 +505,9 @@ u_endscreen(void)
}
void
-display_header(int t)
+display_header(int status)
{
- if (t) {
- header_status = ON;
- } else if (header_status == ON) {
- header_status = ERASE;
- }
+ header_status = status;
}
void