From bede215cf105377a1127532d2d710924cb58cc39 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 4 Sep 2011 16:12:33 +0200 Subject: lineedit: add support for history saving on exit Based on the patch by Dennis Groenen Signed-off-by: Denys Vlasenko --- shell/ash.c | 4 ++++ shell/hush.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index bf376bd0d..14472cb61 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -12888,6 +12888,10 @@ exitshell(void) char *p; int status; +#if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT + save_history(line_input_state); +#endif + status = exitstatus; TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); if (setjmp(loc.loc)) { diff --git a/shell/hush.c b/shell/hush.c index 42143fd9e..a9e2dd311 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1541,6 +1541,10 @@ static sighandler_t pick_sighandler(unsigned sig) static void hush_exit(int exitcode) NORETURN; static void hush_exit(int exitcode) { +#if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT + save_history(G.line_input_state); +#endif + fflush_all(); if (G.exiting <= 0 && G.traps && G.traps[0] && G.traps[0][0]) { char *argv[3]; -- cgit v1.2.3