myadm

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

commit ca3907407c5c3c9759146d6afb9dd1acae7a85d6
parent 66490018975f58ff44e23e8c7bd7983ea826b414
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sun, 14 May 2017 18:41:53 +0200

Automate fragments generation.

Diffstat:
MMakefile | 13+++++++++++--
Mmyadm.c | 7++++---
2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -19,12 +19,16 @@ options: @echo CC $< @${CC} -c ${CFLAGS} $< -${OBJ}: config.h config.mk +${OBJ}: config.h config.mk stflfrag fragments.h config.h: @echo creating $@ from config.def.h @cp config.def.h $@ +fragments.h: + @echo creating $@ + @echo \#define FRAG_ITEMS L\"`./stflfrag items.stfl |sed 's/"/\\\"/g'`\" > $@ + ${APPNAME}: ${OBJ} @echo CC -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} @@ -32,6 +36,7 @@ ${APPNAME}: ${OBJ} clean: @echo cleaning @rm -f ${APPNAME} ${OBJ} ${APPNAME}-${VERSION}.tar.gz + @rm -f stflfrag stflfrag.o fragments.h dist: clean @echo creating dist tarball @@ -52,10 +57,14 @@ install: all @sed "s/VERSION/${VERSION}/g" < ${APPNAME}.1 > ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 @chmod 644 ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 +stflfrag: + @echo CC -o $@ + @${CC} -o $@ $@.c ${LDFLAGS} + uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @rm -f ${DESTDIR}${PREFIX}/bin/${APPNAME} @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 @rm -f ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 -.PHONY: all options clean dist install uninstall +.PHONY: all stflfrag options clean dist install uninstall diff --git a/myadm.c b/myadm.c @@ -29,6 +29,9 @@ #include <sys/stat.h> #include <fcntl.h> +/* STFL fragments (generated via stflfrag) */ +#include "fragments.h" + #include "arg.h" char *argv0; @@ -39,8 +42,6 @@ char *argv0; #define MYSQLIDLEN 64 #define MAXQUERYLEN 4096 -/* STFL fragments (generated via stflfrag) */ -#define FRAG_ITEMS "{vbox[\"main\"]{label .expand:\"0\" text[\"title\"]: @style_normal:\"fg=black,bg=white\"}{label .expand:\"0\" .display[\"showsubtle\"]:\"0\" text[\"subtle\"]: @style_normal:\"fg=blue,bg=black,attr=bold\"}{list[\"items\"] pos[\"pos\"]:\"0\" @style_focus:\"fg=white,bg=blue\" @style_normal:\"fg=white,bg=black\"}{label text[\"info\"]: .expand:\"0\" @style_normal:\"fg=black,bg=white\"}{label text[\"status\"]: .expand:\"0\"}}" typedef union { int i; @@ -588,7 +589,7 @@ ui_listview(Item *items, Field *fields) { int *lens; if(!selview->form) - selview->form = ui_getform((wchar_t *)stfl_ipool_towc(ipool, FRAG_ITEMS)); + selview->form = ui_getform(FRAG_ITEMS); lens = getmaxlengths(items, fields); if(fields) ui_showfields(fields, lens);