Code

sysdb: Store a global input handler object in the input module.
[sysdb.git] / src / tools / sysdb / input.h
index 00b915beabea13735804bc3c1ebc480630d1aa84..ef60bf4d22fa47c0f800c60d4c7da9e192daf02a 100644 (file)
@@ -41,6 +41,19 @@ typedef struct {
 
 #define SDB_INPUT_INIT { NULL, NULL, 0, 0 }
 
+/*
+ * sysdb_input:
+ * Input object to be used by the 'sysdb' command line tool.
+ */
+extern sdb_input_t *sysdb_input;
+
+/*
+ * sdb_input_init:
+ * Initialize the input handler.
+ */
+int
+sdb_input_init(sdb_input_t *input);
+
 /*
  * sdb_input_readline:
  * This function is supposed to be used with a flex scanner's YY_INPUT. It
@@ -53,8 +66,7 @@ typedef struct {
  *  - A negative value in case of an error.
  */
 ssize_t
-sdb_input_readline(sdb_input_t *input, char *buf,
-               int *n_chars, size_t max_chars);
+sdb_input_readline(char *buf, int *n_chars, size_t max_chars);
 
 /*
  * sdb_input_exec_query:
@@ -62,14 +74,7 @@ sdb_input_readline(sdb_input_t *input, char *buf,
  * server's reply and prints errors or returned data to standard output.
  */
 int
-sdb_input_exec_query(sdb_input_t *input);
-
-/*
- * scanner
- */
-
-void
-sdb_input_set(sdb_input_t *new_input);
+sdb_input_exec_query(void);
 
 #endif /* SYSDB_INPUT_H */