myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

commit 22cc3df9b4001f0a1948ed5472bee58b0ab1cb58
parent 546013697420f292881c24e0037c804770583ce2
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Wed, 18 May 2016 20:08:22 +0200

Simpler ui_ask().

Diffstat:
Mmyadm.c | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/myadm.c b/myadm.c @@ -193,16 +193,13 @@ ui_ask(const char *msg, char *opts) { if(msg) ui_set("status", msg); ui_refresh(); - while((c = getch())) { - if(c == '\n') { + while(!(o && *o) && (c = getch())) { + if(c == '\n') o = &opts[0]; - break; - } - for(o = opts; *o; ++o) - if(c == *o) - break; - if(*o) - break; + else + for(o = opts; *o; ++o) + if(c == *o) + break; } ui_set("status", ""); return *o;