index d5deb1dd61b9cf6f26a215ae0efba955a233a48d..939a5146a9ef2369c39de5d7c7f217f62a2dcc96 100644 (file)
--- a/src/tools/sysdb/input.c
+++ b/src/tools/sysdb/input.c
#endif /* HAVE_CONFIG_H */
#include "tools/sysdb/input.h"
+#include "tools/sysdb/command.h"
#include "utils/strbuf.h"
return (ssize_t)len;
} /* sdb_input_readline */
+int
+sdb_input_exec_query(sdb_input_t *input)
+{
+ char *query = sdb_command_exec(input);
+
+ HIST_ENTRY *current_hist;
+ const char *hist_line = NULL;
+
+ if (! query)
+ return -1;
+
+ current_hist = current_history();
+ if (current_hist)
+ hist_line = current_hist->line;
+
+ if (*query != ' ')
+ if ((! hist_line) || strcmp(hist_line, query))
+ add_history(query);
+ free(query);
+ return 0;
+} /* sdb_input_exec_query */
+
/* vim: set tw=78 sw=4 ts=4 noexpandtab : */