X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-scr.c;h=ff20d637781289572d962430b0a094e7195447ce;hp=3966e956aac504037663a6a046a6859282ea0f88;hb=1a9af828d9ad0da0efa7af286db78c8904344e6b;hpb=863c609797ca6d556dd3a4586fc07a6f4a5472d4 diff --git a/ui/ncurses/nc-scr.c b/ui/ncurses/nc-scr.c index 3966e95..ff20d63 100644 --- a/ui/ncurses/nc-scr.c +++ b/ui/ncurses/nc-scr.c @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + +#define _GNU_SOURCE + #include #include @@ -34,6 +38,14 @@ void nc_start(void) intrflush(stdscr, FALSE); /* Disable interrupt flush. */ curs_set(0); /* Make cursor invisible */ nodelay(stdscr, TRUE); /* Enable non-blocking getch() */ + + /* We may be operating with an incorrect $TERM type; in this case + * the keymappings will be slightly broken. We want at least + * backspace to work though, so we'll define both DEL and ^H to + * map to backspace */ + define_key("\x7f", KEY_BACKSPACE); + define_key("\x08", KEY_BACKSPACE); + while (getch() != ERR) /* flush stdin */ (void)0; } @@ -102,7 +114,7 @@ void nc_scr_status_printf(struct nc_scr *scr, const char *format, ...) int nc_scr_init(struct nc_scr *scr, enum pb_nc_sig sig, int begin_x, void *ui_ctx, - void (*process_key)(struct nc_scr *), + void (*process_key)(struct nc_scr *, int), int (*post)(struct nc_scr *), int (*unpost)(struct nc_scr *), void (*resize)(struct nc_scr *))