From 2c4de5b045a79db73052d5b865474a00c9a87e99 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 31 Mar 2011 13:16:52 +0200 Subject: ash,hush: optional support for $HISTFILESIZE. Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com) function old new delta size_from_HISTFILESIZE - 44 +44 hush_main 998 1025 +27 ash_main 1348 1374 +26 read_line_input 3361 3372 +11 new_line_input_t 17 24 +7 Signed-off-by: Denys Vlasenko --- include/libbb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index c371e35f2..f2f3313b4 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1373,8 +1373,9 @@ void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; #if ENABLE_FEATURE_EDITING /* It's NOT just ENABLEd or disabled. It's a number: */ -# ifdef CONFIG_FEATURE_EDITING_HISTORY +# if defined CONFIG_FEATURE_EDITING_HISTORY && CONFIG_FEATURE_EDITING_HISTORY > 0 # define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0) +unsigned size_from_HISTFILESIZE(const char *hp); # else # define MAX_HISTORY 0 # endif @@ -1384,6 +1385,7 @@ typedef struct line_input_t { # if MAX_HISTORY int cnt_history; int cur_history; + int max_history; /* must never be <= 0 */ # if ENABLE_FEATURE_EDITING_SAVEHISTORY unsigned cnt_history_in_file; const char *hist_file; -- cgit v1.2.3