Code

sysdb/json: Only include YAJL headers if they're actually available.
[sysdb.git] / src / tools / sysdb / input.h
index 35b37b800b80f2b6651a43d195beee174bca3c8f..6002c1f3d5464f992c01bae48aa38b55819a0eae 100644 (file)
 
 typedef struct {
        sdb_client_t *client;
+       char *user;
 
        sdb_strbuf_t *input;
        size_t tokenizer_pos;
        size_t query_len;
 
-       _Bool eof;
+       /* 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, 0 }
+#define SDB_INPUT_INIT { NULL, NULL, NULL, 0, 0, 0, 1, 0 }
 
 /*
  * sysdb_input:
@@ -56,6 +61,14 @@ extern sdb_input_t *sysdb_input;
 int
 sdb_input_init(sdb_input_t *input);
 
+/*
+ * sdb_input_reset:
+ * Reset the input handler and free all dynamically allocated memory. The
+ * input handler object itself will not be freed.
+ */
+void
+sdb_input_reset(sdb_input_t *input);
+
 /*
  * sdb_input_mainloop:
  * Wait for and handle all user and server input until end-of-file is read
@@ -90,6 +103,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 : */