diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-02 17:27:28 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-02 17:27:28 +0200 |
commit | 84ea60ed65f6ea6fd3b2170e44bbff5de410a78b (patch) | |
tree | 54837341ed6ed021d9b20400b8a8a5aea7bd3b62 /shell | |
parent | dd4b446f76736c0a13a61a38d7d816b6e6b5fca2 (diff) | |
download | busybox-w32-84ea60ed65f6ea6fd3b2170e44bbff5de410a78b.tar.gz busybox-w32-84ea60ed65f6ea6fd3b2170e44bbff5de410a78b.tar.bz2 busybox-w32-84ea60ed65f6ea6fd3b2170e44bbff5de410a78b.zip |
line editing: make read_line_input() not take timeout param
It's almost always -1.
function old new delta
read_line_input 3902 3912 +10
new_line_input_t 24 31 +7
pgetc 583 585 +2
save_command_ps_at_cur_history 80 78 -2
read_line 76 74 -2
fgetc_interactive 246 244 -2
addLines 84 82 -2
doCommands 2226 2222 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/5 up/down: 19/-12) Total: 7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 5 | ||||
-rw-r--r-- | shell/hush.c | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c index 78baa9aac..b285e3d33 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10185,8 +10185,8 @@ preadfd(void) | |||
10185 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) | 10185 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) |
10186 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); | 10186 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); |
10187 | else { | 10187 | else { |
10188 | int timeout = -1; | ||
10189 | # if ENABLE_ASH_IDLE_TIMEOUT | 10188 | # if ENABLE_ASH_IDLE_TIMEOUT |
10189 | int timeout = -1; | ||
10190 | if (iflag) { | 10190 | if (iflag) { |
10191 | const char *tmout_var = lookupvar("TMOUT"); | 10191 | const char *tmout_var = lookupvar("TMOUT"); |
10192 | if (tmout_var) { | 10192 | if (tmout_var) { |
@@ -10195,12 +10195,13 @@ preadfd(void) | |||
10195 | timeout = -1; | 10195 | timeout = -1; |
10196 | } | 10196 | } |
10197 | } | 10197 | } |
10198 | line_input_state->timeout = timeout; | ||
10198 | # endif | 10199 | # endif |
10199 | # if ENABLE_FEATURE_TAB_COMPLETION | 10200 | # if ENABLE_FEATURE_TAB_COMPLETION |
10200 | line_input_state->path_lookup = pathval(); | 10201 | line_input_state->path_lookup = pathval(); |
10201 | # endif | 10202 | # endif |
10202 | reinit_unicode_for_ash(); | 10203 | reinit_unicode_for_ash(); |
10203 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); | 10204 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ); |
10204 | if (nr == 0) { | 10205 | if (nr == 0) { |
10205 | /* ^C pressed, "convert" to SIGINT */ | 10206 | /* ^C pressed, "convert" to SIGINT */ |
10206 | write(STDOUT_FILENO, "^C", 2); | 10207 | write(STDOUT_FILENO, "^C", 2); |
diff --git a/shell/hush.c b/shell/hush.c index 93ed0bc0b..6fa4e1630 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2411,8 +2411,7 @@ static int get_user_input(struct in_str *i) | |||
2411 | /* buglet: SIGINT will not make new prompt to appear _at once_, | 2411 | /* buglet: SIGINT will not make new prompt to appear _at once_, |
2412 | * only after <Enter>. (^C works immediately) */ | 2412 | * only after <Enter>. (^C works immediately) */ |
2413 | r = read_line_input(G.line_input_state, prompt_str, | 2413 | r = read_line_input(G.line_input_state, prompt_str, |
2414 | G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, | 2414 | G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1 |
2415 | /*timeout*/ -1 | ||
2416 | ); | 2415 | ); |
2417 | /* read_line_input intercepts ^C, "convert" it to SIGINT */ | 2416 | /* read_line_input intercepts ^C, "convert" it to SIGINT */ |
2418 | if (r == 0) | 2417 | if (r == 0) |