From d622a30a82f8ac6914926a5bfdc0e31dff6ce55d Mon Sep 17 00:00:00 2001 From: Malfurious Date: Thu, 6 Jul 2023 06:06:14 -0400 Subject: Rename curshelpers unit to 'helpers' Signed-off-by: Malfurious --- CMakeLists.txt | 2 +- console.c | 2 +- curshelpers.c | 47 ----------------------------------------------- curshelpers.h | 12 ------------ helpers.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ helpers.h | 11 +++++++++++ misplays.c | 2 +- 7 files changed, 61 insertions(+), 62 deletions(-) delete mode 100644 curshelpers.c delete mode 100644 curshelpers.h create mode 100644 helpers.c create mode 100644 helpers.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 29662a6..7a13a74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ add_compile_definitions( add_executable(${PROJECT_NAME} console.c - curshelpers.c + helpers.c misplays.c ) diff --git a/console.c b/console.c index f8949d7..6c1ae53 100644 --- a/console.c +++ b/console.c @@ -4,7 +4,7 @@ #include #include "console.h" -#include "curshelpers.h" +#include "helpers.h" int console_init(struct console *cons) { int master = open("/dev/ptmx", O_RDWR | O_NOCTTY); diff --git a/curshelpers.c b/curshelpers.c deleted file mode 100644 index 7b2f1d1..0000000 --- a/curshelpers.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include - -#include "curshelpers.h" - -void cursinit(void) { - setlocale(LC_ALL, ""); - initscr(); - cbreak(); - noecho(); - keypad(stdscr, TRUE); - curs_set(FALSE); - timeout(25); - refresh(); -} - -void cursupdate(void) { - update_panels(); - doupdate(); -} - -PANEL *newpan(int h, int w, int y, int x) { - WINDOW *win = newwin(h, w, y, x); - scrollok(win, TRUE); - return new_panel(win); -} - -void delpan(PANEL *pan) { - WINDOW *win = panel_window(pan); - del_panel(pan); - delwin(win); -} - -void reset_panel(PANEL *pan, int h, int w, int y, int x) { - WINDOW *win = panel_window(pan); - wresize(win, h, w); - replace_panel(pan, win); - move_panel(pan, y, x); -} - -int pprintw(PANEL *pan, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - int res = vw_printw(panel_window(pan), fmt, args); - va_end(args); - return res; -} diff --git a/curshelpers.h b/curshelpers.h deleted file mode 100644 index d8bda0d..0000000 --- a/curshelpers.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -extern void cursinit(void); -extern void cursupdate(void); - -extern PANEL *newpan(int h, int w, int y, int x); -extern void delpan(PANEL *pan); -extern void reset_panel(PANEL *pan, int h, int w, int y, int x); -extern int pprintw(PANEL *pan, const char *fmt, ...); diff --git a/helpers.c b/helpers.c new file mode 100644 index 0000000..c93b774 --- /dev/null +++ b/helpers.c @@ -0,0 +1,47 @@ +#include +#include + +#include "helpers.h" + +void cursinit(void) { + setlocale(LC_ALL, ""); + initscr(); + cbreak(); + noecho(); + keypad(stdscr, TRUE); + curs_set(FALSE); + timeout(25); + refresh(); +} + +void cursupdate(void) { + update_panels(); + doupdate(); +} + +PANEL *newpan(int h, int w, int y, int x) { + WINDOW *win = newwin(h, w, y, x); + scrollok(win, TRUE); + return new_panel(win); +} + +void delpan(PANEL *pan) { + WINDOW *win = panel_window(pan); + del_panel(pan); + delwin(win); +} + +void reset_panel(PANEL *pan, int h, int w, int y, int x) { + WINDOW *win = panel_window(pan); + wresize(win, h, w); + replace_panel(pan, win); + move_panel(pan, y, x); +} + +int pprintw(PANEL *pan, const char *fmt, ...) { + va_list args; + va_start(args, fmt); + int res = vw_printw(panel_window(pan), fmt, args); + va_end(args); + return res; +} diff --git a/helpers.h b/helpers.h new file mode 100644 index 0000000..7b85319 --- /dev/null +++ b/helpers.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +extern void cursinit(void); +extern void cursupdate(void); +extern PANEL *newpan(int h, int w, int y, int x); +extern void delpan(PANEL *pan); +extern void reset_panel(PANEL *pan, int h, int w, int y, int x); +extern int pprintw(PANEL *pan, const char *fmt, ...); diff --git a/misplays.c b/misplays.c index 5eaca63..1d200a8 100644 --- a/misplays.c +++ b/misplays.c @@ -3,7 +3,7 @@ #include #include "console.h" -#include "curshelpers.h" +#include "helpers.h" static char *const SPLOITCMD[] = { "/bin/bash", "-c", "sploit <(echo 'io.interact()') cat", -- cgit v1.2.3