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 */
|
/* i <= MAX_HISTORY */
|
||||||
state->cur_history = i;
|
state->cur_history = i;
|
||||||
state->cnt_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)
|
if ((state->flags & SAVE_HISTORY) && state->hist_file)
|
||||||
save_history(str);
|
save_history(str);
|
||||||
# endif
|
# 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 */
|
/* With null flags, no other fields are ever used */
|
||||||
state = st ? st : (line_input_t*) &const_int_0;
|
state = st ? st : (line_input_t*) &const_int_0;
|
||||||
|
#if MAX_HISTORY > 0
|
||||||
# if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
# if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||||
if ((state->flags & SAVE_HISTORY) && state->hist_file)
|
if ((state->flags & SAVE_HISTORY) && state->hist_file)
|
||||||
if (state->cnt_history == 0)
|
if (state->cnt_history == 0)
|
||||||
@ -1695,6 +1696,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
|
|||||||
# endif
|
# endif
|
||||||
if (state->flags & DO_HISTORY)
|
if (state->flags & DO_HISTORY)
|
||||||
state->cur_history = state->cnt_history;
|
state->cur_history = state->cnt_history;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* prepare before init handlers */
|
/* prepare before init handlers */
|
||||||
cmdedit_y = 0; /* quasireal y, not true if line > xt*yt */
|
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 (sflag || minusc == NULL) {
|
||||||
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
|
#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||||
if (iflag) {
|
if (iflag) {
|
||||||
const char *hp = lookupvar("HISTFILE");
|
const char *hp = lookupvar("HISTFILE");
|
||||||
if (hp)
|
if (hp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user