summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-11-12 08:54:18 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-11-16 09:14:41 +0100
commitc1be0d907fb57480421d7b684e0f1c4f10b65daa (patch)
tree8524859223406b051b755586ca82ba2c4936134d
parent48493306d27a1e2f7750228a37c32e892ffbb310 (diff)
flowtop: Add header line with tool name & version
Add header bar to be symmetric to the footer. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--flowtop.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/flowtop.c b/flowtop.c
index cab708e..1fdbea3 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1153,22 +1153,22 @@ static void draw_flows(WINDOW *screen, struct flow_list *fl,
static void draw_help(WINDOW *screen)
{
int col = 0;
- int row = 0;
+ int row = 1;
int i;
mvaddch(row, col, ACS_ULCORNER);
- mvaddch(rows - row - 2, col, ACS_LLCORNER);
+ mvaddch(rows - row - 1, col, ACS_LLCORNER);
mvaddch(row, cols - 1, ACS_URCORNER);
- mvaddch(rows - row - 2, cols - col - 1, ACS_LRCORNER);
+ mvaddch(rows - row - 1, cols - 1, ACS_LRCORNER);
for (i = 1; i < rows - row - 2; i++) {
mvaddch(row + i, 0, ACS_VLINE);
- mvaddch(row + i, cols - col - 1, ACS_VLINE);
+ mvaddch(row + i, cols - 1, ACS_VLINE);
}
for (i = 1; i < cols - col - 1; i++) {
- mvaddch(0, col + i, ACS_HLINE);
- mvaddch(rows - row - 2, col + i, ACS_HLINE);
+ mvaddch(row, col + i, ACS_HLINE);
+ mvaddch(rows - row - 1, col + i, ACS_HLINE);
}
attron(A_BOLD);
@@ -1191,6 +1191,19 @@ static void draw_help(WINDOW *screen)
mvaddnstr(row + 12, col + 3, "a Toggle display of active flows (rate > 0) only", -1);
}
+static void draw_header(WINDOW *screen)
+{
+ int i;
+
+ attron(A_STANDOUT);
+
+ for (i = 0; i < cols; i++)
+ mvaddch(0, i, ' ');
+
+ mvwprintw(screen, 0, 2, "flowtop %s", VERSION_LONG);
+ attroff(A_STANDOUT);
+}
+
static void draw_footer(WINDOW *screen)
{
int i;
@@ -1281,6 +1294,8 @@ static void presenter(void)
time_passed_us += time_sleep_us;
}
+ draw_header(screen);
+
if (show_help)
draw_help(screen);