diff options
author | Ondrej Filip <feela@network.cz> | 2012-05-11 00:01:29 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2012-05-11 00:01:29 +0200 |
commit | 72b2db8db7534c52e928618410ec1f18787752c8 (patch) | |
tree | 7eee7f4c26a36f72e0700e9e5d78056f5329f85c /client/client.c | |
parent | 2795700c3158fa52b6cf957e9d0b9ad4a27c67a5 (diff) | |
parent | 95616c820248018f4999972cad315f2da60e4960 (diff) |
Merge branch 'master' of ssh://git.nic.cz/bird
Diffstat (limited to 'client/client.c')
-rw-r--r-- | client/client.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/client/client.c b/client/client.c index 7f9e0ef4..8711cf0a 100644 --- a/client/client.c +++ b/client/client.c @@ -135,6 +135,14 @@ submit_server_command(char *cmd) num_lines = 2; } +static void +add_history_dedup(char *cmd) +{ + /* Add history line if it differs from the last one */ + HIST_ENTRY *he = history_get(history_length); + if (!he || strcmp(he->line, cmd)) + add_history(cmd); +} static void got_line(char *cmd_buffer) @@ -151,7 +159,7 @@ got_line(char *cmd_buffer) cmd = cmd_expand(cmd_buffer); if (cmd) { - add_history(cmd); + add_history_dedup(cmd); if (!handle_internal_command(cmd)) submit_server_command(cmd); @@ -159,7 +167,7 @@ got_line(char *cmd_buffer) free(cmd); } else - add_history(cmd_buffer); + add_history_dedup(cmd_buffer); } free(cmd_buffer); } |