diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:15:08 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:15:08 +0000 |
commit | c0d4367d6b581eb5989c02815880cf0fa2851ae8 (patch) | |
tree | 868c266e627e2d7f65ba5a4d5f98a1c421453181 /libbb/lineedit.c | |
parent | f6bad5ef766b0447158e3de2f55c35f1f6cecb58 (diff) | |
parent | da4441c44f6efccb6f7b7588404d9c6bfb7b6af8 (diff) | |
download | busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.gz busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.bz2 busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.zip |
Merge commit 'da4441c44f6efccb6f7b7588404d9c6bfb7b6af8' into merge
Conflicts:
libbb/vfork_daemon_rexec.c
networking/wget.c
procps/ps.c
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index f9658711a..92ecc330a 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1817,10 +1817,9 @@ static void win_changed(int nsig) | |||
1817 | errno = sv_errno; | 1817 | errno = sv_errno; |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | static int lineedit_read_key(char *read_key_buffer) | 1820 | static int lineedit_read_key(char *read_key_buffer, int timeout) |
1821 | { | 1821 | { |
1822 | int64_t ic; | 1822 | int64_t ic; |
1823 | int timeout = -1; | ||
1824 | #if ENABLE_UNICODE_SUPPORT | 1823 | #if ENABLE_UNICODE_SUPPORT |
1825 | char unicode_buf[MB_CUR_MAX + 1]; | 1824 | char unicode_buf[MB_CUR_MAX + 1]; |
1826 | int unicode_idx = 0; | 1825 | int unicode_idx = 0; |
@@ -1925,7 +1924,7 @@ static int isrtl_str(void) | |||
1925 | * 0 on ctrl-C (the line entered is still returned in 'command'), | 1924 | * 0 on ctrl-C (the line entered is still returned in 'command'), |
1926 | * >0 length of input string, including terminating '\n' | 1925 | * >0 length of input string, including terminating '\n' |
1927 | */ | 1926 | */ |
1928 | int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st) | 1927 | int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) |
1929 | { | 1928 | { |
1930 | int len; | 1929 | int len; |
1931 | #if ENABLE_FEATURE_TAB_COMPLETION | 1930 | #if ENABLE_FEATURE_TAB_COMPLETION |
@@ -2006,7 +2005,6 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
2006 | new_settings.c_cc[VINTR] = _POSIX_VDISABLE; | 2005 | new_settings.c_cc[VINTR] = _POSIX_VDISABLE; |
2007 | tcsetattr_stdin_TCSANOW(&new_settings); | 2006 | tcsetattr_stdin_TCSANOW(&new_settings); |
2008 | 2007 | ||
2009 | /* Now initialize things */ | ||
2010 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); | 2008 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); |
2011 | win_changed(0); /* do initial resizing */ | 2009 | win_changed(0); /* do initial resizing */ |
2012 | #if ENABLE_USERNAME_OR_HOMEDIR | 2010 | #if ENABLE_USERNAME_OR_HOMEDIR |
@@ -2048,7 +2046,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
2048 | int32_t ic, ic_raw; | 2046 | int32_t ic, ic_raw; |
2049 | 2047 | ||
2050 | fflush_all(); | 2048 | fflush_all(); |
2051 | ic = ic_raw = lineedit_read_key(read_key_buffer); | 2049 | ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); |
2052 | 2050 | ||
2053 | #if ENABLE_FEATURE_EDITING_VI | 2051 | #if ENABLE_FEATURE_EDITING_VI |
2054 | newdelflag = 1; | 2052 | newdelflag = 1; |
@@ -2209,7 +2207,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
2209 | case 'd'|VI_CMDMODE_BIT: { | 2207 | case 'd'|VI_CMDMODE_BIT: { |
2210 | int nc, sc; | 2208 | int nc, sc; |
2211 | 2209 | ||
2212 | ic = lineedit_read_key(read_key_buffer); | 2210 | ic = lineedit_read_key(read_key_buffer, timeout); |
2213 | if (errno) /* error */ | 2211 | if (errno) /* error */ |
2214 | goto return_error_indicator; | 2212 | goto return_error_indicator; |
2215 | if (ic == ic_raw) { /* "cc", "dd" */ | 2213 | if (ic == ic_raw) { /* "cc", "dd" */ |
@@ -2273,7 +2271,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
2273 | break; | 2271 | break; |
2274 | case 'r'|VI_CMDMODE_BIT: | 2272 | case 'r'|VI_CMDMODE_BIT: |
2275 | //FIXME: unicode case? | 2273 | //FIXME: unicode case? |
2276 | ic = lineedit_read_key(read_key_buffer); | 2274 | ic = lineedit_read_key(read_key_buffer, timeout); |
2277 | if (errno) /* error */ | 2275 | if (errno) /* error */ |
2278 | goto return_error_indicator; | 2276 | goto return_error_indicator; |
2279 | if (ic < ' ' || ic > 255) { | 2277 | if (ic < ' ' || ic > 255) { |