diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-04 16:15:24 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-04 16:15:24 +0200 |
commit | e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2 (patch) | |
tree | 6f4a97cd2a4374cf152408976fd547b3fcd41d1c | |
parent | bede215cf105377a1127532d2d710924cb58cc39 (diff) | |
download | busybox-w32-e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2.tar.gz busybox-w32-e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2.tar.bz2 busybox-w32-e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2.zip |
lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicator
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/libbb.h | 13 | ||||
-rw-r--r-- | libbb/lineedit.c | 6 | ||||
-rw-r--r-- | shell/hush.c | 3 |
3 files changed, 8 insertions, 14 deletions
diff --git a/include/libbb.h b/include/libbb.h index 91343a95e..1ca448930 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1434,13 +1434,12 @@ typedef struct line_input_t { | |||
1434 | # endif | 1434 | # endif |
1435 | } line_input_t; | 1435 | } line_input_t; |
1436 | enum { | 1436 | enum { |
1437 | DO_HISTORY = 1 * (MAX_HISTORY > 0), | 1437 | DO_HISTORY = 1 * (MAX_HISTORY > 0), |
1438 | SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_EDITING_SAVEHISTORY, | 1438 | TAB_COMPLETION = 2 * ENABLE_FEATURE_TAB_COMPLETION, |
1439 | TAB_COMPLETION = 4 * ENABLE_FEATURE_TAB_COMPLETION, | 1439 | USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION, |
1440 | USERNAME_COMPLETION = 8 * ENABLE_FEATURE_USERNAME_COMPLETION, | 1440 | VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI, |
1441 | VI_MODE = 0x10 * ENABLE_FEATURE_EDITING_VI, | 1441 | WITH_PATH_LOOKUP = 0x10, |
1442 | WITH_PATH_LOOKUP = 0x20, | 1442 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, |
1443 | FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, | ||
1444 | }; | 1443 | }; |
1445 | line_input_t *new_line_input_t(int flags) FAST_FUNC; | 1444 | line_input_t *new_line_input_t(int flags) FAST_FUNC; |
1446 | /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ | 1445 | /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 0786f9ae6..603bbfcae 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1402,8 +1402,6 @@ void save_history(line_input_t *st) | |||
1402 | { | 1402 | { |
1403 | FILE *fp; | 1403 | FILE *fp; |
1404 | 1404 | ||
1405 | if (!(st->flags & SAVE_HISTORY)) | ||
1406 | return; | ||
1407 | if (!st->hist_file) | 1405 | if (!st->hist_file) |
1408 | return; | 1406 | return; |
1409 | if (st->cnt_history <= st->cnt_history_in_file) | 1407 | if (st->cnt_history <= st->cnt_history_in_file) |
@@ -1447,8 +1445,6 @@ static void save_history(char *str) | |||
1447 | int fd; | 1445 | int fd; |
1448 | int len, len2; | 1446 | int len, len2; |
1449 | 1447 | ||
1450 | if (!(state->flags & SAVE_HISTORY)) | ||
1451 | return; | ||
1452 | if (!state->hist_file) | 1448 | if (!state->hist_file) |
1453 | return; | 1449 | return; |
1454 | 1450 | ||
@@ -2188,7 +2184,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2188 | state = st ? st : (line_input_t*) &const_int_0; | 2184 | state = st ? st : (line_input_t*) &const_int_0; |
2189 | #if MAX_HISTORY > 0 | 2185 | #if MAX_HISTORY > 0 |
2190 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY | 2186 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY |
2191 | if ((state->flags & SAVE_HISTORY) && state->hist_file) | 2187 | if (state->hist_file) |
2192 | if (state->cnt_history == 0) | 2188 | if (state->cnt_history == 0) |
2193 | load_history(state); | 2189 | load_history(state); |
2194 | # endif | 2190 | # endif |
diff --git a/shell/hush.c b/shell/hush.c index a9e2dd311..7a34f59ae 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7820,7 +7820,7 @@ int hush_main(int argc, char **argv) | |||
7820 | */ | 7820 | */ |
7821 | 7821 | ||
7822 | #if ENABLE_FEATURE_EDITING | 7822 | #if ENABLE_FEATURE_EDITING |
7823 | G.line_input_state = new_line_input_t(FOR_SHELL & ~SAVE_HISTORY); | 7823 | G.line_input_state = new_line_input_t(FOR_SHELL); |
7824 | #endif | 7824 | #endif |
7825 | 7825 | ||
7826 | /* Initialize some more globals to non-zero values */ | 7826 | /* Initialize some more globals to non-zero values */ |
@@ -8105,7 +8105,6 @@ int hush_main(int argc, char **argv) | |||
8105 | } | 8105 | } |
8106 | if (hp) { | 8106 | if (hp) { |
8107 | G.line_input_state->hist_file = hp; | 8107 | G.line_input_state->hist_file = hp; |
8108 | G.line_input_state->flags |= SAVE_HISTORY; | ||
8109 | //set_local_var(xasprintf("HISTFILE=%s", ...)); | 8108 | //set_local_var(xasprintf("HISTFILE=%s", ...)); |
8110 | } | 8109 | } |
8111 | # if ENABLE_FEATURE_SH_HISTFILESIZE | 8110 | # if ENABLE_FEATURE_SH_HISTFILESIZE |