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 /screen.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 'screen.c')
-rw-r--r-- | screen.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 <curses.h> + +#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(); +} |