1 From 03b2e51fbe2d69823cea54e6b3ecb7db7d981879 Mon Sep 17 00:00:00 2001
2 From: Dennis Groenen <tj.groenen@gmail.com>
3 Date: Sun, 21 Aug 2011 13:31:41 +0200
4 Subject: [PATCH] hush: don't save history when non-interactive
7 shell/hush.c | 7 +++++++
8 1 files changed, 7 insertions(+), 0 deletions(-)
10 diff --git a/shell/hush.c b/shell/hush.c
11 index a7428d6..4ea641b 100644
14 @@ -7832,6 +7832,7 @@ int hush_main(int argc, char **argv)
15 //set_local_var(xasprintf("HISTFILE=%s", ...));
18 + G.line_input_state->flags &= ~SAVE_HISTORY; /* hush is non-interactive at this point */
19 # if ENABLE_FEATURE_SH_HISTFILESIZE
20 hp = get_local_var_value("HISTFILESIZE");
21 G.line_input_state->max_history = size_from_HISTFILESIZE(hp);
22 @@ -8053,6 +8054,12 @@ int hush_main(int argc, char **argv)
23 * standard output is a terminal
24 * Refer to Posix.2, the description of the 'sh' utility.
26 +#if ENABLE_FEATURE_EDITING
27 +# if defined MAX_HISTORY && MAX_HISTORY > 0 && ENABLE_HUSH_SAVEHISTORY
28 + G.line_input_state->flags |= SAVE_HISTORY;
33 if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
34 G_saved_tty_pgrp = tcgetpgrp(STDIN_FILENO);