diff --git a/Makefile b/Makefile index bd01bff..c80f5da 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ EXTERNAL_SERVICES:=1 SCDOC=scdoc -.PHONY: install shellcheck +.PHONY: install test shellcheck test_legacy_nerdfont VERSION:=1.13.0 @@ -33,11 +33,17 @@ docs/%: docs/%.scd all: $(PROGRAMS) $(DOCS) -test: shellcheck +test: shellcheck test_legacy_nerdfont shellcheck: find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x --shell=sh +test_legacy_nerdfont: programs/test_legacy_nerdfont + programs/test_legacy_nerdfont < configs/default_hooks/sxmo_hook_icons.sh + +programs/test_legacy_nerdfont: programs/test_legacy_nerdfont.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(shell pkg-config --cflags --libs icu-io) + programs/%: programs/%.c $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< diff --git a/programs/test_legacy_nerdfont.c b/programs/test_legacy_nerdfont.c new file mode 100644 index 0000000..272b2c9 --- /dev/null +++ b/programs/test_legacy_nerdfont.c @@ -0,0 +1,32 @@ +#include +#include + +int main() { + UFILE *in = u_finit(stdin, NULL, NULL); + int line = 1; + int err = 0; + bool comment = false; + + while (true) { + UChar chr = u_fgetc(in); + if (chr == U_EOF) { + break; + } if (chr == '\n') { + line++; + comment = false; + continue; + } if (chr == '#') { + comment = true; + } + + if (comment) + continue; + + if (chr >= 0xF900 && chr <= 0xFDFF) { + u_printf("ERROR: detected legacy nerd font icon in wrong characer range: \"%C\" 0x%x on line %d\n", chr, chr, line); + err = 1; + } + } + + return err; +}