From 0112ff5203e1bbc37425b87a71326aa0a85ec283 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 25 Oct 2008 23:23:00 +0000 Subject: vi: move key reading routine out of vi into llbbb function old new delta read_key - 310 +310 .... static.esccmds 170 61 -109 readit 286 60 -226 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 9/10 up/down: 349/-367) Total: -18 bytes --- include/libbb.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include/libbb.h') diff --git a/include/libbb.h b/include/libbb.h index 5b92574..9317109 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -921,6 +921,39 @@ void bb_displayroutes(int noresolve, int netstatfmt) FAST_FUNC; #endif +/* "Keycodes" that report an escape sequence. + * We use something which fits into signed char, + * yet doesn't represent any valid Unicode characher. + * Also, -1 is reserved for error indication and we don't use it. */ +enum { + KEYCODE_UP = -2, + KEYCODE_DOWN = -3, + KEYCODE_RIGHT = -4, + KEYCODE_LEFT = -5, + KEYCODE_HOME = -6, + KEYCODE_END = -7, + KEYCODE_INSERT = -8, + KEYCODE_DELETE = -9, + KEYCODE_PAGEUP = -10, + KEYCODE_PAGEDOWN = -11, +#if 0 + KEYCODE_FUN1 = -12, + KEYCODE_FUN2 = -13, + KEYCODE_FUN3 = -14, + KEYCODE_FUN4 = -15, + KEYCODE_FUN5 = -16, + KEYCODE_FUN6 = -17, + KEYCODE_FUN7 = -18, + KEYCODE_FUN8 = -19, + KEYCODE_FUN9 = -20, + KEYCODE_FUN10 = -21, + KEYCODE_FUN11 = -22, + KEYCODE_FUN12 = -23, +#endif +}; +int read_key(int fd, smalluint *nbuffered, char *buffer) FAST_FUNC; + + /* Networking */ int create_icmp_socket(void) FAST_FUNC; int create_icmp6_socket(void) FAST_FUNC; -- cgit v1.1