From c1be0d907fb57480421d7b684e0f1c4f10b65daa Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Thu, 12 Nov 2015 08:54:18 +0200 Subject: flowtop: Add header line with tool name & version Add header bar to be symmetric to the footer. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- flowtop.c | 27 +++++++++++++++++++++------ 1 file 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); -- cgit v1.2.3-54-g00ecf