diff options
author | Tomas Heinrich | 2010-03-09 14:09:24 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-03-09 14:09:24 +0100 |
commit | d2b04050c0a9a15e29e15cbf9c487db93d07c46e (patch) | |
tree | 19929bed97b4e6ddc028465f9fd0a7b3a5d28b5f /libbb/read_key.c | |
parent | f15620c3774c164ee6c1e2fbf9dd481b606a95a1 (diff) | |
download | busybox-d2b04050c0a9a15e29e15cbf9c487db93d07c46e.zip busybox-d2b04050c0a9a15e29e15cbf9c487db93d07c46e.tar.gz |
lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHAR
function old new delta
read_key_ungets - 50 +50
lineedit_read_key 223 252 +29
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/read_key.c')
-rw-r--r-- | libbb/read_key.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/read_key.c b/libbb/read_key.c index a2253ce..98b3131 100644 --- a/libbb/read_key.c +++ b/libbb/read_key.c @@ -246,3 +246,12 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) buffer[-1] = 0; goto start_over; } + +void FAST_FUNC read_key_ungets(char *buffer, const char *str, unsigned len) +{ + unsigned cur_len = (unsigned char)buffer[0]; + if (len > KEYCODE_BUFFER_SIZE-1 - cur_len) + len = KEYCODE_BUFFER_SIZE-1 - cur_len; + memcpy(buffer + 1 + cur_len, str, len); + buffer[0] += cur_len + len; +} |