index 898464af0b550118aa0367337a4e4b85460930c6..f0f86ea2a9bff1e264013bf39c3ab31758919c63 100644 (file)
--- a/src/tools/sysdb/input.c
+++ b/src/tools/sysdb/input.c
}
if (sysdb_input->have_input)
- prompt = "sysdb-> ";
+ prompt = " -> ";
if (sdb_client_eof(sysdb_input->client))
prompt = "!-> ";
if (sdb_client_eof(sysdb_input->client)) {
rl_callback_handler_remove();
/* XXX */
- printf("Remote side closed the connection.\n");
+ sdb_log(SDB_LOG_ERR, "Remote side closed the connection.");
/* return EOF -> restart scanner */
return 0;
}
return 0;
} /* sdb_input_init */
+void
+sdb_input_reset(sdb_input_t *input)
+{
+ sdb_input_t reset = SDB_INPUT_INIT;
+
+ if (! input)
+ return;
+
+ if (input->client)
+ sdb_client_destroy(input->client);
+ if (input->user)
+ free(input->user);
+ if (input->input)
+ sdb_strbuf_destroy(input->input);
+
+ *input = reset;
+} /* sdb_input_reset */
+
int
sdb_input_mainloop(void)
{
{
sdb_client_close(sysdb_input->client);
if (sdb_client_connect(sysdb_input->client, sysdb_input->user)) {
- printf("Failed to reconnect to SysDBd.\n");
+ sdb_log(SDB_LOG_ERR, "Failed to reconnect to SysDBd");
return -1;
}
- printf("Successfully reconnected to SysDBd.\n");
+ sdb_log(SDB_LOG_INFO, "Successfully reconnected to SysDBd");
+ sdb_command_print_server_version(sysdb_input);
return 0;
} /* sdb_input_reconnect */