diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2013-06-24 23:04:44 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2013-06-24 23:14:22 +0200 |
commit | bedc03e69281508ffdb374085225b5ea516c4b13 (patch) | |
tree | 3a1dda0f787c95ab3ad307140341c01658e15f54 /flowtop.c | |
parent | 0d50f6b5e8f682fcb34bfac8c21c83f1a246b4dc (diff) |
ifpps, flowtop: Move ncurses init and end to common module
ncurses (de-)initialization is duplicated across flowtop and ifpps, so
move it to an own module and use it from both tools.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r-- | flowtop.c | 24 |
1 files changed, 3 insertions, 21 deletions
@@ -37,6 +37,7 @@ #include "locking.h" #include "dissector_eth.h" #include "pkt_buff.h" +#include "screen.h" struct flow_entry { uint32_t flow_id, use, status; @@ -740,20 +741,6 @@ static uint16_t presenter_get_port(uint16_t src, uint16_t dst, int tcp) } } -static WINDOW *presenter_screen_init(void) -{ - WINDOW *screen = initscr(); - - noecho(); - cbreak(); - keypad(stdscr, TRUE); - nodelay(screen, TRUE); - refresh(); - wrefresh(screen); - - return screen; -} - static void presenter_screen_do_line(WINDOW *screen, struct flow_entry *n, unsigned int *line) { @@ -987,18 +974,13 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, refresh(); } -static inline void presenter_screen_end(void) -{ - endwin(); -} - static void presenter(void) { int skip_lines = 0; WINDOW *screen; dissector_init_ethernet(0); - screen = presenter_screen_init(); + screen = screen_init(false); rcu_register_thread(); while (!sigint) { @@ -1030,7 +1012,7 @@ static void presenter(void) } rcu_unregister_thread(); - presenter_screen_end(); + screen_end(); dissector_cleanup_ethernet(); } |