diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2016-06-19 23:17:53 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2016-06-19 23:17:53 -0700 |
commit | 12bd59c5ad9f437f1555dd22b1a792c6d4ce490a (patch) | |
tree | 0d818398f74e6f06ee85d9642dc8f39c9f13d981 /src/tty_interface.c | |
parent | 52f091dfd559ba6f4ad9ddeb40411423c4914cd4 (diff) |
Store state in tty_interface_t
Diffstat (limited to 'src/tty_interface.c')
-rw-r--r-- | src/tty_interface.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tty_interface.c b/src/tty_interface.c index 69c3ab1..38b0dc0 100644 --- a/src/tty_interface.c +++ b/src/tty_interface.c @@ -94,9 +94,20 @@ static void emit(choices_t *choices) { #define KEY_DEL 127 #define KEY_ESC 27 -void tty_interface_run(tty_t *tty, choices_t *choices, options_t *options) { +void tty_interface_init(tty_interface_t *state, tty_t *tty, choices_t *choices, options_t *options) { + state->tty = tty; + state->choices = choices; + state->options = options; + if (options->init_search) - strncpy(search, options->init_search, SEARCH_SIZE_MAX); + strncpy(state->search, options->init_search, SEARCH_SIZE_MAX); +} + +void tty_interface_run(tty_interface_t *state) { + tty_t *tty = state->tty; + choices_t *choices = state->choices; + options_t *options = state->options; + char *search = state->search; choices_search(choices, search); char ch; |