From bedc03e69281508ffdb374085225b5ea516c4b13 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 24 Jun 2013 23:04:44 +0200 Subject: 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 --- screen.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 screen.c (limited to 'screen.c') diff --git a/screen.c b/screen.c new file mode 100644 index 0000000..34b27f3 --- /dev/null +++ b/screen.c @@ -0,0 +1,24 @@ +#include + +#include "screen.h" + +WINDOW *screen_init(bool israw) +{ + WINDOW *screen = initscr(); + + if (israw) + raw(); + noecho(); + cbreak(); + nodelay(screen, TRUE); + keypad(stdscr, TRUE); + refresh(); + wrefresh(screen); + + return screen; +} + +void screen_end(void) +{ + endwin(); +} -- cgit v1.2.3-54-g00ecf