summaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <ddevault@linode.com>2015-08-05 17:30:40 -0400
committerLibravatar Drew DeVault <ddevault@linode.com>2015-08-05 17:30:47 -0400
commite07c77fbb78b1d57a19904f2f5a7309ddfc40955 (patch)
tree8d01247340d324cf197706b4f1484c00ef0b1e0c /sway/config.c
parentMIT license (diff)
downloadsway-e07c77fbb78b1d57a19904f2f5a7309ddfc40955.tar.gz
sway-e07c77fbb78b1d57a19904f2f5a7309ddfc40955.tar.zst
sway-e07c77fbb78b1d57a19904f2f5a7309ddfc40955.zip
Build out command subsystem
Everyone loves code stolen from your own projects
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c15
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 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdbool.h>
2#include <stdlib.h> 3#include <stdlib.h>
3#include "readline.h" 4#include "readline.h"
4#include "stringop.h" 5#include "stringop.h"
5#include "list.h" 6#include "list.h"
7#include "commands.h"
6#include "config.h" 8#include "config.h"
7 9
8struct sway_config *read_config(FILE *file) { 10struct sway_config *read_config(FILE *file) {
@@ -10,6 +12,8 @@ struct sway_config *read_config(FILE *file) {
10 config->symbols = create_list(); 12 config->symbols = create_list();
11 config->modes = create_list(); 13 config->modes = create_list();
12 14
15 int temp_braces = 0; // Temporary: skip all config sections with braces
16
13 while (!feof(file)) { 17 while (!feof(file)) {
14 int _; 18 int _;
15 char *line = read_line(file); 19 char *line = read_line(file);
@@ -18,8 +22,17 @@ struct sway_config *read_config(FILE *file) {
18 if (!line[0]) { 22 if (!line[0]) {
19 goto _continue; 23 goto _continue;
20 } 24 }
21 printf("Parsing config line %s\n", line); 25 if (temp_braces && line[0] == '}') {
26 temp_braces--;
27 goto _continue;
28 }
29
30 handle_command(config, line);
31
22_continue: 32_continue:
33 if (line && line[strlen(line) - 1] == '{') {
34 temp_braces++;
35 }
23 free(line); 36 free(line);
24 } 37 }
25 38