summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko2017-08-02 17:27:28 +0200
committerDenys Vlasenko2017-08-02 17:27:28 +0200
commit84ea60ed65f6ea6fd3b2170e44bbff5de410a78b (patch)
tree54837341ed6ed021d9b20400b8a8a5aea7bd3b62 /include
parentdd4b446f76736c0a13a61a38d7d816b6e6b5fca2 (diff)
downloadbusybox-84ea60ed65f6ea6fd3b2170e44bbff5de410a78b.zip
busybox-84ea60ed65f6ea6fd3b2170e44bbff5de410a78b.tar.gz
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.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 9aba719..46180c5 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1639,9 +1639,9 @@ enum {
* buffer[0] is used as a counter of buffered chars and must be 0
* on first call.
* timeout:
- * -2: do not poll for input;
- * -1: poll(-1) (i.e. block);
- * >=0: poll for TIMEOUT milliseconds, return -1/EAGAIN on timeout
+ * -2: do not poll(-1) for input - read() it, return on EAGAIN at once
+ * -1: poll(-1) (i.e. block even on NONBLOCKed fd)
+ * >=0: poll() for TIMEOUT milliseconds, return -1/EAGAIN on timeout
*/
int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC;
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;
# endif
typedef struct line_input_t {
int flags;
+ int timeout;
const char *path_lookup;
# if MAX_HISTORY
int cnt_history;
@@ -1692,7 +1693,7 @@ line_input_t *new_line_input_t(int flags) FAST_FUNC;
* 0 on ctrl-C (the line entered is still returned in 'command'),
* >0 length of input string, including terminating '\n'
*/
-int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) FAST_FUNC;
+int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize) FAST_FUNC;
void show_history(const line_input_t *st) FAST_FUNC;
# if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
void save_history(line_input_t *st);
@@ -1700,7 +1701,7 @@ void save_history(line_input_t *st);
#else
#define MAX_HISTORY 0
int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC;
-#define read_line_input(state, prompt, command, maxsize, timeout) \
+#define read_line_input(state, prompt, command, maxsize) \
read_line_input(prompt, command, maxsize)
#endif