Code

sysdb: Only try to reconnect before executing a command or on an empty line.
[sysdb.git] / src / tools / sysdb / input.h
index 0ba5c0a4dd385169fc439c1fe133b33464f609a8..b8501f472383cd454608c19aebcab8688e784c60 100644 (file)
 
 typedef struct {
        sdb_client_t *client;
+       const char *user;
 
        sdb_strbuf_t *input;
        size_t tokenizer_pos;
        size_t query_len;
 
+       /* indicates that we've had non-empty input */
+       bool have_input;
+
        bool interactive;
        bool eof;
 } sdb_input_t;
 
-#define SDB_INPUT_INIT { NULL, NULL, 0, 0, 1, 0 }
+#define SDB_INPUT_INIT { NULL, NULL, NULL, 0, 0, 0, 1, 0 }
 
 /*
  * sysdb_input:
@@ -91,6 +95,14 @@ sdb_input_readline(char *buf, size_t *n_chars, size_t max_chars);
 int
 sdb_input_exec_query(void);
 
+/*
+ * sdb_input_reconnect:
+ * Let the client reconnect to the server using the settings stored in
+ * sysdb_input.
+ */
+int
+sdb_input_reconnect(void);
+
 #endif /* SYSDB_INPUT_H */
 
 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */