diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-11-26 12:10:05 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-11-26 12:10:05 +0100 |
commit | 3cb7df56e0204bb8b0799a8317ef5a5f38802c7b (patch) | |
tree | e09077073cdcfc14d4202f6904935f2fa9de57bc /minicurses.h | |
parent | 618a6561cd09f489e30ab652da1649a0d1fec1d5 (diff) |
import sfeed_curses
Import sfeed_curses into sfeed.
The files are based of the commit 8e151ce48b503ad0ff0e24cb1be3bc93d6fbd895
Diffstat (limited to 'minicurses.h')
-rw-r--r-- | minicurses.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/minicurses.h b/minicurses.h new file mode 100644 index 0000000..3bc3e8a --- /dev/null +++ b/minicurses.h @@ -0,0 +1,38 @@ +#include <sys/ioctl.h> + +#undef OK +#define OK (0) + +const char *clr_eol = "\x1b[K"; +const char *clear_screen = "\x1b[H\x1b[2J"; +const char *cursor_address = "\x1b[%ld;%ldH"; +const char *cursor_normal = "\x1b[?25h"; /* DECTCEM (in)Visible cursor */ +const char *cursor_invisible = "\x1b[?25l"; /* DECTCEM (in)Visible cursor */ +const char *eat_newline_glitch = (void *)1; +const char *enter_ca_mode = "\x1b[?1049h"; /* smcup */ +const char *exit_ca_mode = "\x1b[?1049l"; /* rmcup */ +const char *save_cursor = "\x1b""7"; +const char *restore_cursor = "\x1b""8"; +const char *exit_attribute_mode = "\x1b[0m"; +const char *enter_bold_mode = "\x1b[1m"; +const char *enter_dim_mode = "\x1b[2m"; +const char *enter_reverse_mode = "\x1b[7m"; + +int +setupterm(char *term, int fildes, int *errret) +{ + return OK; +} + +char * +tparm(const char *s, long p1, long p2, ...) +{ + static char buf[32]; + + if (s == cursor_address) { + snprintf(buf, sizeof(buf), s, p1 + 1, p2 + 1); + return buf; + } + + return (char *)s; +} |