aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-02 22:09:37 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-02 22:09:37 +0000
commit35674e54f092dfac129d992a80833d5ff740fd1d (patch)
treeb94af7c76d4f44472930795a9aff1f8339bc281f /shell
parentf125f45d04958a3f5eeec5380fa06842a64e9078 (diff)
downloadbusybox-w32-35674e54f092dfac129d992a80833d5ff740fd1d.tar.gz
busybox-w32-35674e54f092dfac129d992a80833d5ff740fd1d.tar.bz2
busybox-w32-35674e54f092dfac129d992a80833d5ff740fd1d.zip
Fix kbuild bugs noticed by Bernhard Fischer <rep.nop@aon.at>
git-svn-id: svn://busybox.net/trunk/busybox@16490 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r--shell/Config.in1
-rw-r--r--shell/cmdedit.c18
2 files changed, 9 insertions, 10 deletions
diff --git a/shell/Config.in b/shell/Config.in
index 0e25bedcb..9ac233155 100644
--- a/shell/Config.in
+++ b/shell/Config.in
@@ -257,6 +257,7 @@ config FEATURE_COMMAND_EDITING_VI
257 257
258config FEATURE_COMMAND_HISTORY 258config FEATURE_COMMAND_HISTORY
259 int "History size" 259 int "History size"
260 range 0 99999
260 default 15 261 default 15
261 depends on FEATURE_COMMAND_EDITING 262 depends on FEATURE_COMMAND_EDITING
262 help 263 help
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 35a8d5e27..dda6f6958 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -83,12 +83,10 @@
83#ifndef CONFIG_FEATURE_COMMAND_HISTORY 83#ifndef CONFIG_FEATURE_COMMAND_HISTORY
84#define MAX_HISTORY 15 84#define MAX_HISTORY 15
85#else 85#else
86#define MAX_HISTORY CONFIG_FEATURE_COMMAND_HISTORY 86#define MAX_HISTORY (CONFIG_FEATURE_COMMAND_HISTORY + 0)
87#endif 87#endif
88 88
89#if MAX_HISTORY < 1 89#if MAX_HISTORY > 0
90#warning cmdedit: You set MAX_HISTORY < 1. The history algorithm switched off.
91#else
92static char *history[MAX_HISTORY+1]; /* history + current */ 90static char *history[MAX_HISTORY+1]; /* history + current */
93/* saved history lines */ 91/* saved history lines */
94static int n_history; 92static int n_history;
@@ -1166,7 +1164,7 @@ static void input_tab(int *lastWasTab)
1166} 1164}
1167#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */ 1165#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */
1168 1166
1169#if MAX_HISTORY >= 1 1167#if MAX_HISTORY > 0
1170static void get_previous_history(void) 1168static void get_previous_history(void)
1171{ 1169{
1172 if(command_ps[0] != 0 || history[cur_history] == 0) { 1170 if(command_ps[0] != 0 || history[cur_history] == 0) {
@@ -1529,7 +1527,7 @@ prepare_to_die:
1529 printf("\033[H"); 1527 printf("\033[H");
1530 redraw(0, len-cursor); 1528 redraw(0, len-cursor);
1531 break; 1529 break;
1532#if MAX_HISTORY >= 1 1530#if MAX_HISTORY > 0
1533 case CNTRL('N'): 1531 case CNTRL('N'):
1534 vi_case( case CNTRL('N')|vbit: ) 1532 vi_case( case CNTRL('N')|vbit: )
1535 vi_case( case 'j'|vbit: ) 1533 vi_case( case 'j'|vbit: )
@@ -1730,7 +1728,7 @@ prepare_to_die:
1730 input_tab(&lastWasTab); 1728 input_tab(&lastWasTab);
1731 break; 1729 break;
1732#endif 1730#endif
1733#if MAX_HISTORY >= 1 1731#if MAX_HISTORY > 0
1734 case 'A': 1732 case 'A':
1735 /* Up Arrow -- Get previous command from history */ 1733 /* Up Arrow -- Get previous command from history */
1736 if (cur_history > 0) { 1734 if (cur_history > 0) {
@@ -1838,7 +1836,7 @@ rewrite_line:
1838 setTermSettings(0, (void *) &initial_settings); 1836 setTermSettings(0, (void *) &initial_settings);
1839 handlers_sets &= ~SET_RESET_TERM; 1837 handlers_sets &= ~SET_RESET_TERM;
1840 1838
1841#if MAX_HISTORY >= 1 1839#if MAX_HISTORY > 0
1842 /* Handle command history log */ 1840 /* Handle command history log */
1843 /* cleanup may be saved current command line */ 1841 /* cleanup may be saved current command line */
1844 if (len> 0) { /* no put empty line */ 1842 if (len> 0) { /* no put empty line */
@@ -1859,13 +1857,13 @@ rewrite_line:
1859 num_ok_lines++; 1857 num_ok_lines++;
1860#endif 1858#endif
1861 } 1859 }
1862#else /* MAX_HISTORY < 1 */ 1860#else /* MAX_HISTORY == 0 */
1863#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT) 1861#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
1864 if (len > 0) { /* no put empty line */ 1862 if (len > 0) { /* no put empty line */
1865 num_ok_lines++; 1863 num_ok_lines++;
1866 } 1864 }
1867#endif 1865#endif
1868#endif /* MAX_HISTORY >= 1 */ 1866#endif /* MAX_HISTORY > 0 */
1869 if (break_out > 0) { 1867 if (break_out > 0) {
1870 command[len++] = '\n'; /* set '\n' */ 1868 command[len++] = '\n'; /* set '\n' */
1871 command[len] = 0; 1869 command[len] = 0;