mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
libbb/lineedit: fix the case when we configured history to have 0 lines
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
e74aaf9385
commit
db9c57eed1
@ -1290,7 +1290,7 @@ static void remember_in_history(char *str)
|
||||
/* i <= MAX_HISTORY */
|
||||
state->cur_history = i;
|
||||
state->cnt_history = i;
|
||||
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
# if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
if ((state->flags & SAVE_HISTORY) && state->hist_file)
|
||||
save_history(str);
|
||||
# endif
|
||||
@ -1688,6 +1688,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
|
||||
|
||||
/* With null flags, no other fields are ever used */
|
||||
state = st ? st : (line_input_t*) &const_int_0;
|
||||
#if MAX_HISTORY > 0
|
||||
# if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
if ((state->flags & SAVE_HISTORY) && state->hist_file)
|
||||
if (state->cnt_history == 0)
|
||||
@ -1695,6 +1696,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
|
||||
# endif
|
||||
if (state->flags & DO_HISTORY)
|
||||
state->cur_history = state->cnt_history;
|
||||
#endif
|
||||
|
||||
/* prepare before init handlers */
|
||||
cmdedit_y = 0; /* quasireal y, not true if line > xt*yt */
|
||||
|
@ -13317,7 +13317,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
|
||||
if (sflag || minusc == NULL) {
|
||||
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
if (iflag) {
|
||||
const char *hp = lookupvar("HISTFILE");
|
||||
if (hp)
|
||||
|
Loading…
Reference in New Issue
Block a user