diff --git a/template.conf b/template.conf index d8ee747..39d431c 100644 --- a/template.conf +++ b/template.conf @@ -1,13 +1,11 @@ # This is a comment # these are valid entries -keymap = it -layout = qwerty +KEY_ALT + KEY_S = "xset s on" +KEY_LEFTMETA = 'rofi -show drun' +KEY_LEFTMETA + KEY_L = '/home/ale/scripts/lock.sh' I dont care about whitespaces = true # will be translated to Idontcareaboutwhitespaces=true or tabs = true # is: ortabs=true - -# I can define strings -identifier = "keyboard 0" diff --git a/tests/makefile b/tests/makefile index 59fb382..330d8bb 100644 --- a/tests/makefile +++ b/tests/makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -Wall -Werror -pedantic -O2 +CFLAGS = -Wall -Werror -pedantic parse: parse.c diff --git a/tests/parse.c b/tests/parse.c index 09296fe..f4db9a1 100644 --- a/tests/parse.c +++ b/tests/parse.c @@ -3,6 +3,9 @@ #include #include +#define ANSI_COLOR_RED "\x1b[31m" +#define ANSI_COLOR_RESET "\x1b[0m" + int main(int argc, char const *argv[]) { if (argc < 2) @@ -19,11 +22,20 @@ int main(int argc, char const *argv[]) if (linelen < 2) continue; - printf("%s\n", line); - // remove white spaces + printf(ANSI_COLOR_RED "%s\n" ANSI_COLOR_RESET, line); + /* remove white spaces */ + int inquotes = 0; + int inapos = 0; for (size_t i = 0; i < linelen; i++) { - if (isblank(line[i])) + if (line[i] == '"' && !inapos) + inquotes = !inquotes; + if (line[i] == '\'' && !inquotes) + inapos = !inapos; + + if (isblank(line[i]) && !(inquotes || inapos)) { memmove(&line[i], &line[i + 1], linelen - i); + i -= i ? 1 : 0; + } } if (line[0] == '#') continue;