summaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
authorDenys Vlasenko2009-05-17 16:44:54 +0200
committerDenys Vlasenko2009-05-17 16:44:54 +0200
commit020f40693a08b836abdea74f3823a0bce0378ec5 (patch)
tree4ae11c9b2156cccc1af8904c11c195b25b2886b0 /include/libbb.h
parent071ede1e5de784820f39c2546000c08d74b12f6d (diff)
downloadbusybox-020f40693a08b836abdea74f3823a0bce0378ec5.zip
busybox-020f40693a08b836abdea74f3823a0bce0378ec5.tar.gz
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/libbb.h')
-rw-r--r--include/libbb.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h
index bae7efb..788140d 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -962,16 +962,23 @@ enum {
KEYCODE_FUN11 = -22,
KEYCODE_FUN12 = -23,
#endif
- /* How long the longest ESC sequence we know? */
- KEYCODE_BUFFER_SIZE = 4
+ 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.
*/
-int read_key(int fd, smalluint *nbuffered, char *buffer) FAST_FUNC;
+int64_t read_key(int fd, char *buffer) FAST_FUNC;
/* Networking */