Code

sysdb: Hide implementation details in the "input" module.
[sysdb.git] / src / tools / sysdb / input.c
index c42390f2d1fafd29801523449bbaa1a0c7192e7e..f115e3e2a51088efdf2dec9e5547ffa1a60642cc 100644 (file)
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * This module implements the core of the command line tool. It handles all
+ * input from the user and the remote server, interacting with the scanner and
+ * command handling as needed.
+ *
+ * The main loop is managed by the flex scanner which parses the user input.
+ * It will call into this module (using sdb_input_readline()) whenever it
+ * needs further input to continue parsing. Whenever it finds a full query
+ * (terminated by a semicolon), it will hand the query back to this module
+ * (using sdb_input_exec_query()) which will then execute it.
+ *
+ * Most of the process life-time will be spend waiting for input. User input
+ * and (asynchronous) server replies are handled at the same time.
+ */
+
 #if HAVE_CONFIG_H
 #      include "config.h"
 #endif /* HAVE_CONFIG_H */
@@ -61,6 +76,8 @@
 #      endif
 #endif /* READLINEs */
 
+extern int yylex(void);
+
 /*
  * public variables
  */
@@ -189,6 +206,13 @@ sdb_input_init(sdb_input_t *input)
        return 0;
 } /* sdb_input_init */
 
+int
+sdb_input_mainloop(void)
+{
+       yylex();
+       return 0;
+} /* sdb_input_mainloop */
+
 ssize_t
 sdb_input_readline(char *buf, int *n_chars, size_t max_chars)
 {