/* * This file exists because the curses UI is horribly * namespace-invasive. For example, including declares a * function called fullname()! (There are a lot of similar examples; * fullname just happens to be the first one I tripped over.) This we * can't have a variable, not even a static one, called fullname, in a * file which includes . * * So, this is the only file that includes ; all other files * that want to touch curses stuff do it by calling into here. */ #include #include #include extern const char *__progname; #include "ui.h" void ui_init(void) { if (! initscr()) { fprintf(stderr,"%s: initscr failed\n",__progname); exit(1); } raw(); noecho(); keypad(stdscr,FALSE); } void ui_done(void) { move(LINES-1,0); endwin(); printf("\n"); } void ui_beep(void) { beep(); } int ui_cols(void) { return(COLS); } int ui_lines(void) { return(LINES); } void ui_standout(void) { standout(); } void ui_standend(void) { standend(); } void ui_move(int y, int x) { move(y,x); } void ui_addch(char ch) { addch(ch); } void ui_clrtoeol(void) { clrtoeol(); } void ui_addstr(const char *s) { addstr(s); } void ui_addnstr(const char *s, int l) { addnstr(s,l); } void ui_refresh(void) { refresh(); }