summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7a1ccee)
raw | patch | inline | side by side (parent: 7a1ccee)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 11 Dec 2014 21:42:39 +0000 (22:42 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 11 Dec 2014 21:42:39 +0000 (22:42 +0100) |
current_history() returns the currently *selected* history entry. Rather, we
want the latest entry, that is, the one added last.
want the latest entry, that is, the one added last.
src/tools/sysdb/input.c | patch | blob | history |
index 08f639f1ac104c9a8c0527321bc92ba89070e4db..a88b2266147de67a659cd383e802a0a61701f7ce 100644 (file)
--- a/src/tools/sysdb/input.c
+++ b/src/tools/sysdb/input.c
{
char *query = sdb_command_exec(sysdb_input);
- HIST_ENTRY *current_hist;
- const char *hist_line = NULL;
+ HIST_ENTRY *hist;
+ const char *prev = NULL;
if (! query)
return -1;
- current_hist = current_history();
- if (current_hist)
- hist_line = current_hist->line;
+ hist = history_get(history_length);
+ if (hist)
+ prev = hist->line;
if (*query != ' ')
- if ((! hist_line) || strcmp(hist_line, query))
+ if ((! prev) || strcmp(prev, query))
add_history(query);
free(query);
return 0;