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-w32-4b7db4f2ca232c630e334fa56b1eb89848d5fcc5.tar.gz busybox-w32-4b7db4f2ca232c630e334fa56b1eb89848d5fcc5.tar.bz2 busybox-w32-4b7db4f2ca232c630e334fa56b1eb89848d5fcc5.zip |
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; | |||
933 | #endif | 933 | #endif |
934 | 934 | ||
935 | 935 | ||
936 | /* "Keycodes" that report an escape sequence. | ||
937 | * We use something which fits into signed char, | ||
938 | * yet doesn't represent any valid Unicode characher. | ||
939 | * Also, -1 is reserved for error indication and we don't use it. */ | ||
940 | enum { | ||
941 | KEYCODE_UP = -2, | ||
942 | KEYCODE_DOWN = -3, | ||
943 | KEYCODE_RIGHT = -4, | ||
944 | KEYCODE_LEFT = -5, | ||
945 | KEYCODE_HOME = -6, | ||
946 | KEYCODE_END = -7, | ||
947 | KEYCODE_INSERT = -8, | ||
948 | KEYCODE_DELETE = -9, | ||
949 | KEYCODE_PAGEUP = -10, | ||
950 | KEYCODE_PAGEDOWN = -11, | ||
951 | #if 0 | ||
952 | KEYCODE_FUN1 = -12, | ||
953 | KEYCODE_FUN2 = -13, | ||
954 | KEYCODE_FUN3 = -14, | ||
955 | KEYCODE_FUN4 = -15, | ||
956 | KEYCODE_FUN5 = -16, | ||
957 | KEYCODE_FUN6 = -17, | ||
958 | KEYCODE_FUN7 = -18, | ||
959 | KEYCODE_FUN8 = -19, | ||
960 | KEYCODE_FUN9 = -20, | ||
961 | KEYCODE_FUN10 = -21, | ||
962 | KEYCODE_FUN11 = -22, | ||
963 | KEYCODE_FUN12 = -23, | ||
964 | #endif | ||
965 | KEYCODE_CURSOR_POS = -0x100, | ||
966 | /* How long is the longest ESC sequence we know? | ||
967 | * We want it big enough to be able to contain | ||
968 | * cursor position sequence "ESC [ 9999 ; 9999 R" | ||
969 | */ | ||
970 | KEYCODE_BUFFER_SIZE = 16 | ||
971 | }; | ||
972 | /* Note: fd may be in blocking or non-blocking mode, both make sense. | ||
973 | * For one, less uses non-blocking mode. | ||
974 | * Only the first read syscall inside read_key may block indefinitely | ||
975 | * (unless fd is in non-blocking mode), | ||
976 | * subsequent reads will time out after a few milliseconds. | ||
977 | * Return of -1 means EOF or error (errno == 0 on EOF). | ||
978 | * buffer[0] is used as a counter of buffered chars and must be 0 | ||
979 | * on first call. | ||
980 | */ | ||
981 | int64_t read_key(int fd, char *buffer) FAST_FUNC; | ||
982 | |||
983 | |||
984 | /* Networking */ | 936 | /* Networking */ |
985 | int create_icmp_socket(void) FAST_FUNC; | 937 | int create_icmp_socket(void) FAST_FUNC; |
986 | int create_icmp6_socket(void) FAST_FUNC; | 938 | int create_icmp6_socket(void) FAST_FUNC; |
@@ -1209,6 +1161,54 @@ unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC; | |||
1209 | #endif | 1161 | #endif |
1210 | 1162 | ||
1211 | 1163 | ||
1164 | /* "Keycodes" that report an escape sequence. | ||
1165 | * We use something which fits into signed char, | ||
1166 | * yet doesn't represent any valid Unicode characher. | ||
1167 | * Also, -1 is reserved for error indication and we don't use it. */ | ||
1168 | enum { | ||
1169 | KEYCODE_UP = -2, | ||
1170 | KEYCODE_DOWN = -3, | ||
1171 | KEYCODE_RIGHT = -4, | ||
1172 | KEYCODE_LEFT = -5, | ||
1173 | KEYCODE_HOME = -6, | ||
1174 | KEYCODE_END = -7, | ||
1175 | KEYCODE_INSERT = -8, | ||
1176 | KEYCODE_DELETE = -9, | ||
1177 | KEYCODE_PAGEUP = -10, | ||
1178 | KEYCODE_PAGEDOWN = -11, | ||
1179 | #if 0 | ||
1180 | KEYCODE_FUN1 = -12, | ||
1181 | KEYCODE_FUN2 = -13, | ||
1182 | KEYCODE_FUN3 = -14, | ||
1183 | KEYCODE_FUN4 = -15, | ||
1184 | KEYCODE_FUN5 = -16, | ||
1185 | KEYCODE_FUN6 = -17, | ||
1186 | KEYCODE_FUN7 = -18, | ||
1187 | KEYCODE_FUN8 = -19, | ||
1188 | KEYCODE_FUN9 = -20, | ||
1189 | KEYCODE_FUN10 = -21, | ||
1190 | KEYCODE_FUN11 = -22, | ||
1191 | KEYCODE_FUN12 = -23, | ||
1192 | #endif | ||
1193 | KEYCODE_CURSOR_POS = -0x100, | ||
1194 | /* How long is the longest ESC sequence we know? | ||
1195 | * We want it big enough to be able to contain | ||
1196 | * cursor position sequence "ESC [ 9999 ; 9999 R" | ||
1197 | */ | ||
1198 | KEYCODE_BUFFER_SIZE = 16 | ||
1199 | }; | ||
1200 | /* Note: fd may be in blocking or non-blocking mode, both make sense. | ||
1201 | * For one, less uses non-blocking mode. | ||
1202 | * Only the first read syscall inside read_key may block indefinitely | ||
1203 | * (unless fd is in non-blocking mode), | ||
1204 | * subsequent reads will time out after a few milliseconds. | ||
1205 | * Return of -1 means EOF or error (errno == 0 on EOF). | ||
1206 | * buffer[0] is used as a counter of buffered chars and must be 0 | ||
1207 | * on first call. | ||
1208 | */ | ||
1209 | int64_t read_key(int fd, char *buffer) FAST_FUNC; | ||
1210 | |||
1211 | |||
1212 | #if ENABLE_FEATURE_EDITING | 1212 | #if ENABLE_FEATURE_EDITING |
1213 | /* It's NOT just ENABLEd or disabled. It's a number: */ | 1213 | /* It's NOT just ENABLEd or disabled. It's a number: */ |
1214 | # ifdef CONFIG_FEATURE_EDITING_HISTORY | 1214 | # ifdef CONFIG_FEATURE_EDITING_HISTORY |