* cc: kyogre1@… (added)
--
Ticket URL: <http://www.midnight-commander.org/ticket/2104#comment:22>
Midnight Commander <https://midnight-commander.org>
Midnight Development Center
Comment (by zaytsev):
I have checked the source code and it seems that !BusyBox shells
(ash/hush) don't support HISTCONTROL. I've sent a patch to
bus...@busybox.net, for now it's bounced, no idea what happens next.
{{{
From 1165db3b3851e3fece948da669e9b520d4db37f9 Mon Sep 17 00:00:00 2001
From: "Yury V. Zaytsev" <yu...@shurup.com>
Date: Sun, 6 Oct 2024 15:03:19 +0200
Subject: [PATCH] lineedit: add basic support for bash-style HISTCONTROL
options
Signed-off-by: Yury V. Zaytsev <yu...@shurup.com>
---
libbb/lineedit.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 151208c1c..1cdf16cea 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1657,6 +1657,7 @@ static void save_history(char *str)
static void remember_in_history(char *str)
{
int i;
+ char *histcontrol;
if (!(state->flags & DO_HISTORY))
return;
@@ -1667,6 +1668,12 @@ static void remember_in_history(char *str)
if (i && strcmp(state->history[i-1], str) == 0)
return;
+ if ((histcontrol = getenv("HISTCONTROL"))
+ && (strstr(histcontrol, "ignorespace")
+ || strstr (histcontrol, "ignoreboth"))
+ && str[0] == ' ')
+ return;
+
free(state->history[state->max_history]); /* redundant, paranoia
*/
state->history[state->max_history] = NULL; /* redundant, paranoia
*/
--
2.46.2
}}}
It seems that csh/tcsh only supports this:
{{{
beastie@freebsd:~ $ csh
beastie@freebsd:~ $ unset savehist
}}}
No idea if we should set it when we fork the shell (but then user commands
will be lost as well) or there is some way to do our business forking new
instances all the time, but I guess not.
--
Ticket URL: <http://www.midnight-commander.org/ticket/2104#comment:23>
Comment (by zaytsev):
Dash also has the same problem, interesting to talk to the developers,
maybe they would agree to do HISTCONTROL:
http://gondor.apana.org.au/~herbert/dash/
--
Ticket URL: <http://www.midnight-commander.org/ticket/2104#comment:24>
Comment (by zaytsev):
https://lore.kernel.org/dash/36590CFE-D82B-4A0D-
A3A3-574...@shurup.com/T/#u
--
Ticket URL: <http://www.midnight-commander.org/ticket/2104#comment:25>
Comment (by zaytsev):
No luck with Busybox list, posted to Bugzilla instead:
https://bugs.busybox.net/show_bug.cgi?id=16213
--
Ticket URL: <http://www.midnight-commander.org/ticket/2104#comment:26>