aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libbb.h5
-rw-r--r--libbb/lineedit.c4
-rw-r--r--shell/msh.c4
3 files changed, 7 insertions, 6 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 525162d05..028116fe1 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -963,10 +963,9 @@ enum {
963}; 963};
964line_input_t *new_line_input_t(int flags); 964line_input_t *new_line_input_t(int flags);
965/* Returns: 965/* Returns:
966 * -1 on read errors or EOF, or on bare Ctrl-D. 966 * -1 on read errors or EOF, or on bare Ctrl-D,
967 * 0 on ctrl-C, 967 * 0 on ctrl-C (the line entered is still returned in 'command'),
968 * >0 length of input string, including terminating '\n' 968 * >0 length of input string, including terminating '\n'
969 * [is this true? stores "" in 'command' if return value is 0 or -1]
970 */ 969 */
971int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state); 970int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state);
972#else 971#else
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d3ee7386e..c191b0572 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1315,8 +1315,8 @@ static void win_changed(int nsig)
1315#define CTRL(a) ((a) & ~0x40) 1315#define CTRL(a) ((a) & ~0x40)
1316 1316
1317/* Returns: 1317/* Returns:
1318 * -1 on read errors or EOF, or on bare Ctrl-D. 1318 * -1 on read errors or EOF, or on bare Ctrl-D,
1319 * 0 on ctrl-C, 1319 * 0 on ctrl-C (the line entered is still returned in 'command'),
1320 * >0 length of input string, including terminating '\n' 1320 * >0 length of input string, including terminating '\n'
1321 */ 1321 */
1322int read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st) 1322int read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st)
diff --git a/shell/msh.c b/shell/msh.c
index 7371120ca..9a1be36d9 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -4836,7 +4836,9 @@ static int filechar(struct ioarg *ap)
4836 static int position = 0, size = 0; 4836 static int position = 0, size = 0;
4837 4837
4838 while (size == 0 || position >= size) { 4838 while (size == 0 || position >= size) {
4839 read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state); 4839 /* Repeat if Ctrl-C is pressed. TODO: exit on -1 (error/EOF)? */
4840 while (read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state) == 0)
4841 continue;
4840 size = strlen(filechar_cmdbuf); 4842 size = strlen(filechar_cmdbuf);
4841 position = 0; 4843 position = 0;
4842 } 4844 }