diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-05-29 10:39:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-05-29 10:39:06 +0200 |
commit | 4b7db4f2ca232c630e334fa56b1eb89848d5fcc5 (patch) | |
tree | 55608587f33fc1d6f6a8e40dfdf7fea66c750d7a /include | |
parent | 171932d7ca62dbb0e0b84a0919e1f3a8a68f03f2 (diff) | |
download | busybox-4b7db4f2ca232c630e334fa56b1eb89848d5fcc5.tar.gz |
read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/include/libbb.h b/include/libbb.h index 788140d14..963e2af28 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -933,54 +933,6 @@ 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 - KEYCODE_CURSOR_POS = -0x100, - /* How long is the longest ESC sequence we know? - * We want it big enough to be able to contain - * cursor position sequence "ESC [ 9999 ; 9999 R" - */ - KEYCODE_BUFFER_SIZE = 16 -}; -/* Note: fd may be in blocking or non-blocking mode, both make sense. - * For one, less uses non-blocking mode. - * Only the first read syscall inside read_key may block indefinitely - * (unless fd is in non-blocking mode), - * subsequent reads will time out after a few milliseconds. - * Return of -1 means EOF or error (errno == 0 on EOF). - * buffer[0] is used as a counter of buffered chars and must be 0 - * on first call. - */ -int64_t read_key(int fd, char *buffer) FAST_FUNC; - - /* Networking */ int create_icmp_socket(void) FAST_FUNC; int create_icmp6_socket(void) FAST_FUNC; @@ -1209,6 +1161,54 @@ unsigned long long bb_makedev(unsigned int major, unsigned int minor) 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 + KEYCODE_CURSOR_POS = -0x100, + /* How long is the longest ESC sequence we know? + * We want it big enough to be able to contain + * cursor position sequence "ESC [ 9999 ; 9999 R" + */ + KEYCODE_BUFFER_SIZE = 16 +}; +/* Note: fd may be in blocking or non-blocking mode, both make sense. + * For one, less uses non-blocking mode. + * Only the first read syscall inside read_key may block indefinitely + * (unless fd is in non-blocking mode), + * subsequent reads will time out after a few milliseconds. + * Return of -1 means EOF or error (errno == 0 on EOF). + * buffer[0] is used as a counter of buffered chars and must be 0 + * on first call. + */ +int64_t read_key(int fd, char *buffer) FAST_FUNC; + + #if ENABLE_FEATURE_EDITING /* It's NOT just ENABLEd or disabled. It's a number: */ # ifdef CONFIG_FEATURE_EDITING_HISTORY |