myadm

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

commit 2129e7f0eaa371202d4d1f9086e79c93213ce1bf
parent 865912975206deb671869e51797c50827223acc1
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Tue,  1 Mar 2016 20:43:33 +0100

Add config.h

Diffstat:
Aconfig.h | 29+++++++++++++++++++++++++++++
Mcore.c | 34+---------------------------------
2 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/config.h b/config.h @@ -0,0 +1,29 @@ +static const char *dbhost = "localhost"; +static const char *dbuser = "root"; +static const char *dbpass = "m0r3s3cur3"; + +static Mode modes[] = { + /* name show function */ + { "databases", databases }, /* first entry is default */ + { "tables", tables }, + { "records", records }, + { "text", text }, +}; + +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} }, + { "databases", L"q", quit, {.i = 0} }, + { "databases", L"ENTER", usedb, {.v = &modes[1]} }, + { "databases", L"SPACE", usedb, {.v = &modes[1]} }, + { "tables", L"ENTER", usetable, {.v = &modes[2]} }, + { "tables", L"SPACE", usetable, {.v = &modes[2]} }, + { "records", L"ENTER", userecord, {0} }, + { "records", L"d", flagas, {.v = "D"} }, + { "records", L"t", flagas, {.v = "*"} }, +}; diff --git a/core.c b/core.c @@ -82,39 +82,7 @@ void userecord(const Arg *arg); void itempos(const Arg *arg); void reload(const Arg *arg); -/* config.h > */ - -static const char *dbhost = "localhost"; -static const char *dbuser = "root"; -static const char *dbpass = "m0r3s3cur3"; - -static Mode modes[] = { - /* name show function */ - { "databases", databases }, /* first entry is default */ - { "tables", tables }, - { "records", records }, - { "text", text }, -}; - -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} }, - { "databases", L"q", quit, {.i = 0} }, - { "databases", L"ENTER", usedb, {.v = &modes[1]} }, - { "databases", L"SPACE", usedb, {.v = &modes[1]} }, - { "tables", L"ENTER", usetable, {.v = &modes[2]} }, - { "tables", L"SPACE", usetable, {.v = &modes[2]} }, - { "records", L"ENTER", userecord, {0} }, - { "records", L"d", flagas, {.v = "D"} }, - { "records", L"t", flagas, {.v = "*"} }, -}; - -/* < config.h */ +#include "config.h" /* variables */ static int running = 1;