myadm

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

commit 3c423e0bb537197c3b8c9d8c32a9c8bd077c5379
parent ae1dac03defcefd4773d2c6684c3c384858d4fad
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Mon, 21 Mar 2016 17:19:11 +0100

Make modkey a char *.

Diffstat:
Mconfig.def.h | 28++++++++++++++--------------
Mmyadm.c | 10+++++-----
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -11,18 +11,18 @@ static void (*welcome)(const Arg *arg) = databases; static Key keys[] = { /* mode modkey function argument */ - { NULL, L"Q", quit, {.i = 1} }, - { NULL, L"q", viewprev, {0} }, - { NULL, L"k", itempos, {.i = -1} }, - { NULL, L"j", itempos, {.i = +1} }, - { NULL, L"I", reload, {0} }, - { NULL, L"$", apply, {.i = 1} }, - { NULL, L"?", help, {0} }, - { "databases", L"q", quit, {.i = 0} }, - { "databases", L"ENTER", tables, {0} }, - { "databases", L"SPACE", tables, {0} }, - { "tables", L"ENTER", records, {.i = 500} }, - { "tables", L"SPACE", records, {.i = 500} }, - { "records", L"d", flagas, {.v = "D"} }, - { "records", L"t", flagas, {.v = "*"} }, + { NULL, "Q", quit, {.i = 1} }, + { NULL, "q", viewprev, {0} }, + { NULL, "k", itempos, {.i = -1} }, + { NULL, "j", itempos, {.i = +1} }, + { NULL, "I", reload, {0} }, + { NULL, "$", apply, {.i = 1} }, + { NULL, "?", help, {0} }, + { "databases", "q", quit, {.i = 0} }, + { "databases", "ENTER", tables, {0} }, + { "databases", "SPACE", tables, {0} }, + { "tables", "ENTER", records, {.i = 500} }, + { "tables", "SPACE", records, {.i = 500} }, + { "records", "d", flagas, {.v = "D"} }, + { "records", "t", flagas, {.v = "*"} }, }; diff --git a/myadm.c b/myadm.c @@ -55,7 +55,7 @@ struct Field { typedef struct { const char *mode; - const wchar_t *modkey; + const char *modkey; void (*func)(const Arg *); const Arg arg; } Key; @@ -543,11 +543,11 @@ stfl_showitems(Item *items, int *lens) { * 0 never ask */ void quit(const Arg *arg) { - if(arg->i) { - char *opts = "yn"; + char *opts = "yn"; + + if(arg->i) if(ask("Do you want to quit ([y]/n)?", opts) != opts[0]) return; - } running = 0; } @@ -599,7 +599,7 @@ run(void) { k = NULL; for(i = 0; i < LENGTH(keys); ++i) if(!((keys[i].mode && strcmp(selview->mode->name, keys[i].mode)) - || wcscmp(ev, keys[i].modkey))) + || strcmp(stfl_ipool_fromwc(ipool, ev), keys[i].modkey))) k = &keys[i]; if(k) k->func(&k->arg);