X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ftools%2Fsysdb%2Finput.h;h=0ba5c0a4dd385169fc439c1fe133b33464f609a8;hb=49b5a4d2e8e4fb1e4f67c2a368d8d2e3e76b765f;hp=ef60bf4d22fa47c0f800c60d4c7da9e192daf02a;hpb=3dfbb8002ceb61be3cb61a7764c98fef4b6c011a;p=sysdb.git diff --git a/src/tools/sysdb/input.h b/src/tools/sysdb/input.h index ef60bf4..0ba5c0a 100644 --- a/src/tools/sysdb/input.h +++ b/src/tools/sysdb/input.h @@ -37,9 +37,12 @@ typedef struct { sdb_strbuf_t *input; size_t tokenizer_pos; size_t query_len; + + bool interactive; + bool eof; } sdb_input_t; -#define SDB_INPUT_INIT { NULL, NULL, 0, 0 } +#define SDB_INPUT_INIT { NULL, NULL, 0, 0, 1, 0 } /* * sysdb_input: @@ -54,6 +57,18 @@ extern sdb_input_t *sysdb_input; int sdb_input_init(sdb_input_t *input); +/* + * sdb_input_mainloop: + * Wait for and handle all user and server input until end-of-file is read + * from the user (on the standard input channel). + * + * Returns: + * - 0 on success + * - a negative value else + */ +int +sdb_input_mainloop(void); + /* * sdb_input_readline: * This function is supposed to be used with a flex scanner's YY_INPUT. It @@ -66,7 +81,7 @@ sdb_input_init(sdb_input_t *input); * - A negative value in case of an error. */ ssize_t -sdb_input_readline(char *buf, int *n_chars, size_t max_chars); +sdb_input_readline(char *buf, size_t *n_chars, size_t max_chars); /* * sdb_input_exec_query: