mirror of
https://github.com/swaywm/sway.git
synced 2025-11-09 13:29:49 -05:00
Pull in some scas code and read i3 config file
This commit is contained in:
parent
6a33e1e3cd
commit
542ef0c777
10 changed files with 351 additions and 2 deletions
27
sway/config.c
Normal file
27
sway/config.c
Normal file
|
|
@ -0,0 +1,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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue