X-Git-Url: https://git.gag.com/?p=debian%2Fcpmtools;a=blobdiff_plain;f=term_curses.c;fp=term_curses.c;h=8d5661403107868510dac05ae3e7d31da62221f5;hp=0000000000000000000000000000000000000000;hb=0244ff6db7cb417c6210118e14ebc8a11924b7f6;hpb=be51a0b47ec4edacc689851a88ec6172737cb61c diff --git a/term_curses.c b/term_curses.c new file mode 100644 index 0000000..8d56614 --- /dev/null +++ b/term_curses.c @@ -0,0 +1,88 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include "config.h" + +#include +#include +#ifdef NEED_NCURSES +#ifdef HAVE_NCURSES_NCURSES_H +#include +#else +#include +#endif +#else +#include +#endif +#include +#include +#include +#include + +#include "term.h" +/*}}}*/ + +void term_init(void) /*{{{*/ +{ + initscr(); + noecho(); + raw(); + nonl(); + idlok(stdscr,TRUE); + idcok(stdscr,TRUE); + keypad(stdscr,TRUE); + clear(); +} +/*}}}*/ +void term_exit(void) /*{{{*/ +{ + move(LINES-1,0); + refresh(); + echo(); + noraw(); + endwin(); +} +/*}}}*/ +void term_clear(void) /*{{{*/ +{ + clear(); +} +/*}}}*/ +void term_xy(int x, int y) /*{{{*/ +{ + move(y,x); +} +/*}}}*/ +void term_printf(char const *fmt, ...) /*{{{*/ +{ + va_list ap; + + va_start(ap, fmt); + vw_printw(stdscr, fmt, ap); + va_end(ap); +} +/*}}}*/ +void term_putch(char ch) /*{{{*/ +{ + addch(ch); +} +/*}}}*/ +int term_getch(void) /*{{{*/ +{ + return getch(); +} +/*}}}*/ +void term_reverse(int on) /*{{{*/ +{ + if (on) attron(A_REVERSE); + else attroff(A_REVERSE); +} +/*}}}*/ +int term_lines(void) /*{{{*/ +{ + return LINES; +} +/*}}}*/ +int term_cols(void) /*{{{*/ +{ + return COLS; +} +/*}}}*/