diff options
author | 2015-08-04 21:30:40 -0400 | |
---|---|---|
committer | 2015-08-04 21:30:40 -0400 | |
commit | 542ef0c77700e67a95fcd08b5f305d1ab42046e1 (patch) | |
tree | 17333ebc1a65a28b9538de2da9264a45fc0cf9a9 /sway/config.c | |
parent | Initial commit (diff) | |
download | sway-542ef0c77700e67a95fcd08b5f305d1ab42046e1.tar.gz sway-542ef0c77700e67a95fcd08b5f305d1ab42046e1.tar.zst sway-542ef0c77700e67a95fcd08b5f305d1ab42046e1.zip |
Pull in some scas code and read i3 config file
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c new file mode 100644 index 00000000..3ad1bcf9 --- /dev/null +++ b/sway/config.c | |||
@@ -0,0 +1,27 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include "readline.h" | ||
4 | #include "stringop.h" | ||
5 | #include "list.h" | ||
6 | #include "config.h" | ||
7 | |||
8 | struct sway_config *read_config(FILE *file) { | ||
9 | struct sway_config *config = malloc(sizeof(struct sway_config)); | ||
10 | config->symbols = create_list(); | ||
11 | config->modes = create_list(); | ||
12 | |||
13 | while (!feof(file)) { | ||
14 | int _; | ||
15 | char *line = read_line(file); | ||
16 | line = strip_whitespace(line, &_); | ||
17 | line = strip_comments(line); | ||
18 | if (!line[0]) { | ||
19 | goto _continue; | ||
20 | } | ||
21 | printf("Parsing config line %s\n", line); | ||
22 | _continue: | ||
23 | free(line); | ||
24 | } | ||
25 | |||
26 | return config; | ||
27 | } | ||