diff options
author | Drew DeVault <[email protected]> | 2015-08-05 17:30:40 -0400 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2015-08-05 17:30:47 -0400 |
commit | e07c77fbb78b1d57a19904f2f5a7309ddfc40955 (patch) | |
tree | 8d01247340d324cf197706b4f1484c00ef0b1e0c /sway/config.c | |
parent | f82660b01e2e24b30e608e945523709ce9bd7bea (diff) |
Build out command subsystem
Everyone loves code stolen from your own projects
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c index 3ad1bcf9..bb6533c2 100644 --- a/sway/config.c +++ b/sway/config.c @@ -1,8 +1,10 @@ #include <stdio.h> +#include <stdbool.h> #include <stdlib.h> #include "readline.h" #include "stringop.h" #include "list.h" +#include "commands.h" #include "config.h" struct sway_config *read_config(FILE *file) { @@ -10,6 +12,8 @@ struct sway_config *read_config(FILE *file) { config->symbols = create_list(); config->modes = create_list(); + int temp_braces = 0; // Temporary: skip all config sections with braces + while (!feof(file)) { int _; char *line = read_line(file); @@ -18,8 +22,17 @@ struct sway_config *read_config(FILE *file) { if (!line[0]) { goto _continue; } - printf("Parsing config line %s\n", line); + if (temp_braces && line[0] == '}') { + temp_braces--; + goto _continue; + } + + handle_command(config, line); + _continue: + if (line && line[strlen(line) - 1] == '{') { + temp_braces++; + } free(line); } |