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 /ifpps.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 'ifpps.c')
-rw-r--r-- | ifpps.c | 23 |
1 files changed, 2 insertions, 21 deletions
@@ -28,6 +28,7 @@ #include "promisc.h" #include "cpus.h" #include "built_in.h" +#include "screen.h" struct wifi_stat { uint32_t bitrate; @@ -635,21 +636,6 @@ static void stats_top(const struct ifstat *rel, const struct ifstat *abs, } } -static void screen_init(WINDOW **screen) -{ - (*screen) = initscr(); - - raw(); - noecho(); - cbreak(); - nodelay((*screen), TRUE); - - keypad(stdscr, TRUE); - - refresh(); - wrefresh((*screen)); -} - static void screen_header(WINDOW *screen, const char *ifname, int *voff, uint64_t ms_interval, unsigned int top_cpus) { @@ -931,17 +917,12 @@ static void screen_update(WINDOW *screen, const char *ifname, const struct ifsta refresh(); } -static void screen_end(void) -{ - endwin(); -} - static int screen_main(const char *ifname, uint64_t ms_interval, unsigned int top_cpus) { int first = 1, key; - screen_init(&stats_screen); + stats_screen = screen_init(true); while (!sigint) { key = getch(); |