1 From e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Sun, 4 Sep 2011 16:15:24 +0200
4 Subject: [PATCH 3/3] lineedit: remove SAVE_HISTORY bit, ->hist_file can be
7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 include/libbb.h | 13 ++++++-------
10 libbb/lineedit.c | 6 +-----
12 3 files changed, 8 insertions(+), 14 deletions(-)
14 diff --git a/include/libbb.h b/include/libbb.h
15 index 91343a9..1ca4489 100644
18 @@ -1434,13 +1434,12 @@ typedef struct line_input_t {
22 - DO_HISTORY = 1 * (MAX_HISTORY > 0),
23 - SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_EDITING_SAVEHISTORY,
24 - TAB_COMPLETION = 4 * ENABLE_FEATURE_TAB_COMPLETION,
25 - USERNAME_COMPLETION = 8 * ENABLE_FEATURE_USERNAME_COMPLETION,
26 - VI_MODE = 0x10 * ENABLE_FEATURE_EDITING_VI,
27 - WITH_PATH_LOOKUP = 0x20,
28 - FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
29 + DO_HISTORY = 1 * (MAX_HISTORY > 0),
30 + TAB_COMPLETION = 2 * ENABLE_FEATURE_TAB_COMPLETION,
31 + USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION,
32 + VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI,
33 + WITH_PATH_LOOKUP = 0x10,
34 + FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
36 line_input_t *new_line_input_t(int flags) FAST_FUNC;
37 /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
38 diff --git a/libbb/lineedit.c b/libbb/lineedit.c
39 index 0786f9a..603bbfc 100644
40 --- a/libbb/lineedit.c
41 +++ b/libbb/lineedit.c
42 @@ -1402,8 +1402,6 @@ void save_history(line_input_t *st)
46 - if (!(st->flags & SAVE_HISTORY))
50 if (st->cnt_history <= st->cnt_history_in_file)
51 @@ -1447,8 +1445,6 @@ static void save_history(char *str)
55 - if (!(state->flags & SAVE_HISTORY))
57 if (!state->hist_file)
60 @@ -2188,7 +2184,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
61 state = st ? st : (line_input_t*) &const_int_0;
63 # if ENABLE_FEATURE_EDITING_SAVEHISTORY
64 - if ((state->flags & SAVE_HISTORY) && state->hist_file)
65 + if (state->hist_file)
66 if (state->cnt_history == 0)
69 diff --git a/shell/hush.c b/shell/hush.c
70 index a9e2dd3..7a34f59 100644
73 @@ -7820,7 +7820,7 @@ int hush_main(int argc, char **argv)
76 #if ENABLE_FEATURE_EDITING
77 - G.line_input_state = new_line_input_t(FOR_SHELL & ~SAVE_HISTORY);
78 + G.line_input_state = new_line_input_t(FOR_SHELL);
81 /* Initialize some more globals to non-zero values */
82 @@ -8105,7 +8105,6 @@ int hush_main(int argc, char **argv)
85 G.line_input_state->hist_file = hp;
86 - G.line_input_state->flags |= SAVE_HISTORY;
87 //set_local_var(xasprintf("HISTFILE=%s", ...));
89 # if ENABLE_FEATURE_SH_HISTFILESIZE