diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-04 16:12:33 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-04 16:12:33 +0200 |
| commit | bede215cf105377a1127532d2d710924cb58cc39 (patch) | |
| tree | d0227961b7eb002cb03653f2e69211e6cf13d598 /shell | |
| parent | 4840ae8a06298e987374fa3cc6d7e4969fd19344 (diff) | |
| download | busybox-w32-bede215cf105377a1127532d2d710924cb58cc39.tar.gz busybox-w32-bede215cf105377a1127532d2d710924cb58cc39.tar.bz2 busybox-w32-bede215cf105377a1127532d2d710924cb58cc39.zip | |
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.c | 4 | ||||
| -rw-r--r-- | shell/hush.c | 4 |
2 files changed, 8 insertions, 0 deletions
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) | |||
| 12888 | char *p; | 12888 | char *p; |
| 12889 | int status; | 12889 | int status; |
| 12890 | 12890 | ||
| 12891 | #if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | ||
| 12892 | save_history(line_input_state); | ||
| 12893 | #endif | ||
| 12894 | |||
| 12891 | status = exitstatus; | 12895 | status = exitstatus; |
| 12892 | TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); | 12896 | TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); |
| 12893 | if (setjmp(loc.loc)) { | 12897 | 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) | |||
| 1541 | static void hush_exit(int exitcode) NORETURN; | 1541 | static void hush_exit(int exitcode) NORETURN; |
| 1542 | static void hush_exit(int exitcode) | 1542 | static void hush_exit(int exitcode) |
| 1543 | { | 1543 | { |
| 1544 | #if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | ||
| 1545 | save_history(G.line_input_state); | ||
| 1546 | #endif | ||
| 1547 | |||
| 1544 | fflush_all(); | 1548 | fflush_all(); |
| 1545 | if (G.exiting <= 0 && G.traps && G.traps[0] && G.traps[0][0]) { | 1549 | if (G.exiting <= 0 && G.traps && G.traps[0] && G.traps[0][0]) { |
| 1546 | char *argv[3]; | 1550 | char *argv[3]; |
