summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-05-17 16:44:54 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-05-17 16:44:54 +0200
commit020f40693a08b836abdea74f3823a0bce0378ec5 (patch)
tree4ae11c9b2156cccc1af8904c11c195b25b2886b0 /include
parent071ede1e5de784820f39c2546000c08d74b12f6d (diff)
downloadbusybox-w32-020f40693a08b836abdea74f3823a0bce0378ec5.tar.gz
busybox-w32-020f40693a08b836abdea74f3823a0bce0378ec5.tar.bz2
busybox-w32-020f40693a08b836abdea74f3823a0bce0378ec5.zip
line editing: add an option to emit ESC [ 6 n and use results
This makes line editing able to recognize case when cursor was not at the beginning of the line. It may also be adapted later to find out display size (serial line users would love it). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h
index bae7efb00..788140d14 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -962,16 +962,23 @@ enum {
962 KEYCODE_FUN11 = -22, 962 KEYCODE_FUN11 = -22,
963 KEYCODE_FUN12 = -23, 963 KEYCODE_FUN12 = -23,
964#endif 964#endif
965 /* How long the longest ESC sequence we know? */ 965 KEYCODE_CURSOR_POS = -0x100,
966 KEYCODE_BUFFER_SIZE = 4 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
967}; 971};
968/* Note: fd may be in blocking or non-blocking mode, both make sense. 972/* Note: fd may be in blocking or non-blocking mode, both make sense.
969 * For one, less uses non-blocking mode. 973 * For one, less uses non-blocking mode.
970 * Only the first read syscall inside read_key may block indefinitely 974 * Only the first read syscall inside read_key may block indefinitely
971 * (unless fd is in non-blocking mode), 975 * (unless fd is in non-blocking mode),
972 * subsequent reads will time out after a few milliseconds. 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.
973 */ 980 */
974int read_key(int fd, smalluint *nbuffered, char *buffer) FAST_FUNC; 981int64_t read_key(int fd, char *buffer) FAST_FUNC;
975 982
976 983
977/* Networking */ 984/* Networking */