aboutsummaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 540eb7ea7..69f833747 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1153,7 +1153,8 @@ enum {
1153 * 1153 *
1154 */ 1154 */
1155 1155
1156extern void cmdedit_read_input(char *prompt, char command[BUFSIZ]) 1156
1157int cmdedit_read_input(char *prompt, char command[BUFSIZ])
1157{ 1158{
1158 1159
1159 int break_out = 0; 1160 int break_out = 0;
@@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
1231 * if the len=0 and no chars to delete */ 1232 * if the len=0 and no chars to delete */
1232 if (len == 0) { 1233 if (len == 0) {
1233prepare_to_die: 1234prepare_to_die:
1235#if !defined(BB_FEATURE_ASH)
1234 printf("exit"); 1236 printf("exit");
1235 goto_new_line(); 1237 goto_new_line();
1236 /* cmdedit_reset_term() called in atexit */ 1238 /* cmdedit_reset_term() called in atexit */
1237 exit(EXIT_SUCCESS); 1239 exit(EXIT_SUCCESS);
1240#else
1241 break_out = -1; /* for control stoped jobs */
1242 break;
1243#endif
1238 } else { 1244 } else {
1239 input_delete(); 1245 input_delete();
1240 } 1246 }
@@ -1455,8 +1461,10 @@ prepare_to_die:
1455 num_ok_lines++; 1461 num_ok_lines++;
1456#endif 1462#endif
1457 } 1463 }
1464 if(break_out>0) {
1458 command[len++] = '\n'; /* set '\n' */ 1465 command[len++] = '\n'; /* set '\n' */
1459 command[len] = 0; 1466 command[len] = 0;
1467 }
1460#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) 1468#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
1461 input_tab(0); /* strong free */ 1469 input_tab(0); /* strong free */
1462#endif 1470#endif
@@ -1464,6 +1472,7 @@ prepare_to_die:
1464 free(cmdedit_prompt); 1472 free(cmdedit_prompt);
1465#endif 1473#endif
1466 cmdedit_reset_term(); 1474 cmdedit_reset_term();
1475 return len;
1467} 1476}
1468 1477
1469 1478