Hi
I wrote a patch to ignore duplicates if HISTCONTROL contains
"ignoredups". This is bash's behaviour I got used to. Haven't
implemented the other options HISTCONTROL offers, as they don't make
much sense to me.
Please consider applying.
Christoph
PS: I'll be on holidays for the next 5 days, so don't expect a reply
in that time.
--- libbb/lineedit.c.orig 2008-02-21 15:21:55.138621401 +0100
+++ libbb/lineedit.c 2008-02-21 15:17:15.202247444 +0100
@@ -1013,6 +1005,16 @@
return;
i = state->cnt_history;
+
+ /* ignore duplicates */
+ if (i != 0 && strcmp(state->history[i-1], str) == 0) {
+ char *p;
+ if ((p = getenv("HISTCONTROL")) && strstr(p, "ignoredups")) {
+ state->cur_history = state->cnt_history;
+ return;
+ }
+ }
+
free(state->history[MAX_HISTORY]);
state->history[MAX_HISTORY] = NULL;
/* After max history, remove the oldest command */
@@ -1021,8 +1023,6 @@
for (i = 0; i < MAX_HISTORY-1; i++)
state->history[i] = state->history[i+1];
}
-// Maybe "if (!i || strcmp(history[i-1], command) != 0) ..."
-// (i.e. do not save dups?)
state->history[i++] = xstrdup(str);
state->cur_history = i;
state->cnt_history = i;
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox