aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
blob: 3ad1bcf9774859fa4445216395ade856cf82aaa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include "readline.h"
#include "stringop.h"
#include "list.h"
#include "config.h"

struct sway_config *read_config(FILE *file) {
	struct sway_config *config = malloc(sizeof(struct sway_config));
	config->symbols = create_list();
	config->modes = create_list();

	while (!feof(file)) {
		int _;
		char *line = read_line(file);
		line = strip_whitespace(line, &_);
		line = strip_comments(line);
		if (!line[0]) {
			goto _continue;
		}
		printf("Parsing config line %s\n", line);
_continue:
		free(line);
	}

	return config;
}