summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2011-09-04 16:12:33 +0200
committerDenys Vlasenko2011-09-04 16:12:33 +0200
commitbede215cf105377a1127532d2d710924cb58cc39 (patch)
treed0227961b7eb002cb03653f2e69211e6cf13d598 /shell
parent4840ae8a06298e987374fa3cc6d7e4969fd19344 (diff)
downloadbusybox-bede215cf105377a1127532d2d710924cb58cc39.zip
busybox-bede215cf105377a1127532d2d710924cb58cc39.tar.gz
lineedit: add support for history saving on exit
Based on the patch by Dennis Groenen <tj.groenen@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c4
-rw-r--r--shell/hush.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index bf376bd..14472cb 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 42143fd..a9e2dd3 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];