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 /include | |
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 'include')
-rw-r--r-- | include/libbb.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h index 9aba71949..46180c5aa 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1639,9 +1639,9 @@ enum { | |||
1639 | * buffer[0] is used as a counter of buffered chars and must be 0 | 1639 | * buffer[0] is used as a counter of buffered chars and must be 0 |
1640 | * on first call. | 1640 | * on first call. |
1641 | * timeout: | 1641 | * timeout: |
1642 | * -2: do not poll for input; | 1642 | * -2: do not poll(-1) for input - read() it, return on EAGAIN at once |
1643 | * -1: poll(-1) (i.e. block); | 1643 | * -1: poll(-1) (i.e. block even on NONBLOCKed fd) |
1644 | * >=0: poll for TIMEOUT milliseconds, return -1/EAGAIN on timeout | 1644 | * >=0: poll() for TIMEOUT milliseconds, return -1/EAGAIN on timeout |
1645 | */ | 1645 | */ |
1646 | int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC; | 1646 | int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC; |
1647 | void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; | 1647 | void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; |
@@ -1657,6 +1657,7 @@ unsigned size_from_HISTFILESIZE(const char *hp) FAST_FUNC; | |||
1657 | # endif | 1657 | # endif |
1658 | typedef struct line_input_t { | 1658 | typedef struct line_input_t { |
1659 | int flags; | 1659 | int flags; |
1660 | int timeout; | ||
1660 | const char *path_lookup; | 1661 | const char *path_lookup; |
1661 | # if MAX_HISTORY | 1662 | # if MAX_HISTORY |
1662 | int cnt_history; | 1663 | int cnt_history; |
@@ -1692,7 +1693,7 @@ line_input_t *new_line_input_t(int flags) FAST_FUNC; | |||
1692 | * 0 on ctrl-C (the line entered is still returned in 'command'), | 1693 | * 0 on ctrl-C (the line entered is still returned in 'command'), |
1693 | * >0 length of input string, including terminating '\n' | 1694 | * >0 length of input string, including terminating '\n' |
1694 | */ | 1695 | */ |
1695 | int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) FAST_FUNC; | 1696 | int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize) FAST_FUNC; |
1696 | void show_history(const line_input_t *st) FAST_FUNC; | 1697 | void show_history(const line_input_t *st) FAST_FUNC; |
1697 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | 1698 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT |
1698 | void save_history(line_input_t *st); | 1699 | void save_history(line_input_t *st); |
@@ -1700,7 +1701,7 @@ void save_history(line_input_t *st); | |||
1700 | #else | 1701 | #else |
1701 | #define MAX_HISTORY 0 | 1702 | #define MAX_HISTORY 0 |
1702 | int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; | 1703 | int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; |
1703 | #define read_line_input(state, prompt, command, maxsize, timeout) \ | 1704 | #define read_line_input(state, prompt, command, maxsize) \ |
1704 | read_line_input(prompt, command, maxsize) | 1705 | read_line_input(prompt, command, maxsize) |
1705 | #endif | 1706 | #endif |
1706 | 1707 | ||