summaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-02-04 08:24:39 +0000
committerGlenn L McGrath2004-02-04 08:24:39 +0000
commit16e45d7e29a35c57fc31484e72f1294144e4899c (patch)
treeece28ef81d8de5930894aa3e9b61f8a64022ec7a /shell/cmdedit.c
parent31b98dd09748535a5004e948bb560c320d179a66 (diff)
downloadbusybox-16e45d7e29a35c57fc31484e72f1294144e4899c.zip
busybox-16e45d7e29a35c57fc31484e72f1294144e4899c.tar.gz
Vodz last_patch_125_2, this patch have:
- synced with dash 0.4.21 - better handle trap "cmds..." SIGINT (strange, i make bad hack for ash and cmdedit, but this work only with this...) - may be haven`t problem with Ctrl-D
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index f54d5d5..c0fa1b2 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1283,10 +1283,15 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
case 3:
/* Control-c -- stop gathering input */
goto_new_line();
+#ifndef CONFIG_ASH
command[0] = 0;
len = 0;
lastWasTab = FALSE;
put_prompt();
+#else
+ len = 0;
+ break_out = -1; /* for control traps */
+#endif
break;
case 4:
/* Control-d -- Delete one character, or exit
@@ -1299,7 +1304,7 @@ prepare_to_die:
/* cmdedit_reset_term() called in atexit */
exit(EXIT_SUCCESS);
#else
- break_out = -1; /* for control stoped jobs */
+ len = break_out = -1; /* for control stoped jobs */
break;
#endif
} else {
@@ -1493,7 +1498,7 @@ rewrite_line:
/* cleanup may be saved current command line */
free(history[MAX_HISTORY]);
history[MAX_HISTORY] = 0;
- if (len) { /* no put empty line */
+ if (len> 0) { /* no put empty line */
int i = n_history;
/* After max history, remove the oldest command */
if (i >= MAX_HISTORY) {
@@ -1510,7 +1515,7 @@ rewrite_line:
}
#else /* MAX_HISTORY < 1 */
#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
- if (len) { /* no put empty line */
+ if (len > 0) { /* no put empty line */
num_ok_lines++;
}
#endif