aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-31 17:15:57 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-31 17:15:57 +0000
commit4f990533e35b75a89f6ec86d9835e97ea5aafaa0 (patch)
tree0c55989a98164cf06555576e6bc8f4b7576644bd
parentf12cc4ee68ec33a77576e582b48705730fcde359 (diff)
downloadbusybox-w32-4f990533e35b75a89f6ec86d9835e97ea5aafaa0.tar.gz
busybox-w32-4f990533e35b75a89f6ec86d9835e97ea5aafaa0.tar.bz2
busybox-w32-4f990533e35b75a89f6ec86d9835e97ea5aafaa0.zip
Patch from Vladimir to fix up autocompletion on a files/dirs with spaces in
them in the presence of a quoting. Also revert my signal handling patch, which seems to not solve the problem I thought it solved.
-rw-r--r--cmdedit.c17
-rw-r--r--shell/cmdedit.c17
2 files changed, 8 insertions, 26 deletions
diff --git a/cmdedit.c b/cmdedit.c
index a87723139..a2b238603 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -571,7 +571,6 @@ extern void cmdedit_init(void)
571 atexit(cmdedit_reset_term); /* be sure to do this only once */ 571 atexit(cmdedit_reset_term); /* be sure to do this only once */
572 } 572 }
573 573
574#if 0
575 if ((handlers_sets & SET_TERM_HANDLERS) == 0) { 574 if ((handlers_sets & SET_TERM_HANDLERS) == 0) {
576 signal(SIGKILL, clean_up_and_die); 575 signal(SIGKILL, clean_up_and_die);
577 signal(SIGINT, clean_up_and_die); 576 signal(SIGINT, clean_up_and_die);
@@ -579,8 +578,6 @@ extern void cmdedit_init(void)
579 signal(SIGTERM, clean_up_and_die); 578 signal(SIGTERM, clean_up_and_die);
580 handlers_sets |= SET_TERM_HANDLERS; 579 handlers_sets |= SET_TERM_HANDLERS;
581 } 580 }
582#endif
583
584} 581}
585 582
586#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 583#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION
@@ -983,17 +980,14 @@ static int find_match(char *matchBuf, int *len_with_quotes)
983 || (int_buf[i + 1] & ~QUOT) == '~')) { 980 || (int_buf[i + 1] & ~QUOT) == '~')) {
984 i++; 981 i++;
985 } 982 }
986 if (i) {
987 collapse_pos(0, i);
988 }
989 983
990 /* set only match and destroy quotes */ 984 /* set only match and destroy quotes */
991 j = 0; 985 j = 0;
992 for (i = 0; pos_buf[i] >= 0; i++) { 986 for (c = 0; pos_buf[i] >= 0; i++) {
993 matchBuf[i] = matchBuf[pos_buf[i]]; 987 matchBuf[c++] = matchBuf[pos_buf[i]];
994 j = pos_buf[i] + 1; 988 j = pos_buf[i] + 1;
995 } 989 }
996 matchBuf[i] = 0; 990 matchBuf[c] = 0;
997 /* old lenght matchBuf with quotes symbols */ 991 /* old lenght matchBuf with quotes symbols */
998 *len_with_quotes = j ? j - pos_buf[0] : 0; 992 *len_with_quotes = j ? j - pos_buf[0] : 0;
999 993
@@ -1097,8 +1091,7 @@ static void input_tab(int *lastWasTab)
1097 /* new len */ 1091 /* new len */
1098 len = strlen(command_ps); 1092 len = strlen(command_ps);
1099 /* write out the matched command */ 1093 /* write out the matched command */
1100 input_end(); 1094 redraw(cmdedit_y, len - recalc_pos);
1101 input_backward(cursor - recalc_pos);
1102 } 1095 }
1103 if (tmp != matches[0]) 1096 if (tmp != matches[0])
1104 free(tmp); 1097 free(tmp);
@@ -1489,7 +1482,6 @@ prepare_to_die:
1489extern void cmdedit_terminate(void) 1482extern void cmdedit_terminate(void)
1490{ 1483{
1491 cmdedit_reset_term(); 1484 cmdedit_reset_term();
1492#if 0
1493 if ((handlers_sets & SET_TERM_HANDLERS) != 0) { 1485 if ((handlers_sets & SET_TERM_HANDLERS) != 0) {
1494 signal(SIGKILL, SIG_DFL); 1486 signal(SIGKILL, SIG_DFL);
1495 signal(SIGINT, SIG_DFL); 1487 signal(SIGINT, SIG_DFL);
@@ -1498,7 +1490,6 @@ extern void cmdedit_terminate(void)
1498 signal(SIGWINCH, SIG_DFL); 1490 signal(SIGWINCH, SIG_DFL);
1499 handlers_sets &= ~SET_TERM_HANDLERS; 1491 handlers_sets &= ~SET_TERM_HANDLERS;
1500 } 1492 }
1501#endif
1502} 1493}
1503 1494
1504#endif /* BB_FEATURE_COMMAND_EDITING */ 1495#endif /* BB_FEATURE_COMMAND_EDITING */
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index a87723139..a2b238603 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -571,7 +571,6 @@ extern void cmdedit_init(void)
571 atexit(cmdedit_reset_term); /* be sure to do this only once */ 571 atexit(cmdedit_reset_term); /* be sure to do this only once */
572 } 572 }
573 573
574#if 0
575 if ((handlers_sets & SET_TERM_HANDLERS) == 0) { 574 if ((handlers_sets & SET_TERM_HANDLERS) == 0) {
576 signal(SIGKILL, clean_up_and_die); 575 signal(SIGKILL, clean_up_and_die);
577 signal(SIGINT, clean_up_and_die); 576 signal(SIGINT, clean_up_and_die);
@@ -579,8 +578,6 @@ extern void cmdedit_init(void)
579 signal(SIGTERM, clean_up_and_die); 578 signal(SIGTERM, clean_up_and_die);
580 handlers_sets |= SET_TERM_HANDLERS; 579 handlers_sets |= SET_TERM_HANDLERS;
581 } 580 }
582#endif
583
584} 581}
585 582
586#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 583#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION
@@ -983,17 +980,14 @@ static int find_match(char *matchBuf, int *len_with_quotes)
983 || (int_buf[i + 1] & ~QUOT) == '~')) { 980 || (int_buf[i + 1] & ~QUOT) == '~')) {
984 i++; 981 i++;
985 } 982 }
986 if (i) {
987 collapse_pos(0, i);
988 }
989 983
990 /* set only match and destroy quotes */ 984 /* set only match and destroy quotes */
991 j = 0; 985 j = 0;
992 for (i = 0; pos_buf[i] >= 0; i++) { 986 for (c = 0; pos_buf[i] >= 0; i++) {
993 matchBuf[i] = matchBuf[pos_buf[i]]; 987 matchBuf[c++] = matchBuf[pos_buf[i]];
994 j = pos_buf[i] + 1; 988 j = pos_buf[i] + 1;
995 } 989 }
996 matchBuf[i] = 0; 990 matchBuf[c] = 0;
997 /* old lenght matchBuf with quotes symbols */ 991 /* old lenght matchBuf with quotes symbols */
998 *len_with_quotes = j ? j - pos_buf[0] : 0; 992 *len_with_quotes = j ? j - pos_buf[0] : 0;
999 993
@@ -1097,8 +1091,7 @@ static void input_tab(int *lastWasTab)
1097 /* new len */ 1091 /* new len */
1098 len = strlen(command_ps); 1092 len = strlen(command_ps);
1099 /* write out the matched command */ 1093 /* write out the matched command */
1100 input_end(); 1094 redraw(cmdedit_y, len - recalc_pos);
1101 input_backward(cursor - recalc_pos);
1102 } 1095 }
1103 if (tmp != matches[0]) 1096 if (tmp != matches[0])
1104 free(tmp); 1097 free(tmp);
@@ -1489,7 +1482,6 @@ prepare_to_die:
1489extern void cmdedit_terminate(void) 1482extern void cmdedit_terminate(void)
1490{ 1483{
1491 cmdedit_reset_term(); 1484 cmdedit_reset_term();
1492#if 0
1493 if ((handlers_sets & SET_TERM_HANDLERS) != 0) { 1485 if ((handlers_sets & SET_TERM_HANDLERS) != 0) {
1494 signal(SIGKILL, SIG_DFL); 1486 signal(SIGKILL, SIG_DFL);
1495 signal(SIGINT, SIG_DFL); 1487 signal(SIGINT, SIG_DFL);
@@ -1498,7 +1490,6 @@ extern void cmdedit_terminate(void)
1498 signal(SIGWINCH, SIG_DFL); 1490 signal(SIGWINCH, SIG_DFL);
1499 handlers_sets &= ~SET_TERM_HANDLERS; 1491 handlers_sets &= ~SET_TERM_HANDLERS;
1500 } 1492 }
1501#endif
1502} 1493}
1503 1494
1504#endif /* BB_FEATURE_COMMAND_EDITING */ 1495#endif /* BB_FEATURE_COMMAND_EDITING */