diff options
author | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-12 22:36:25 +0200 |
---|---|---|
committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-12 22:36:25 +0200 |
commit | 879e2d68fefc407bfbf41dfbc0d68d52c9b46bc7 (patch) | |
tree | c147611f1b537f2b0a3e52d3d9f2fb421666b491 | |
parent | b489ca48635a2d58ed99ad6b2cf34183c197c019 (diff) |
feed config line by line to parser
-rw-r--r-- | main-sdl.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -207,6 +207,29 @@ worker(void *args) | |||
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | static void | ||
211 | config_parse(char *config_file) | ||
212 | { | ||
213 | FILE *fh = fopen(config_file, "r"); | ||
214 | char line_in[512]; | ||
215 | |||
216 | if (!fh) { | ||
217 | fprintf(stderr, "Couldn't open config file %s, exiting.\n", config_file); | ||
218 | exit(1); | ||
219 | } | ||
220 | config_reset(); | ||
221 | while (!feof(fh)) { | ||
222 | char *line = fgets(line_in, sizeof(line_in), fh); | ||
223 | |||
224 | if (!line) | ||
225 | continue; | ||
226 | if (config_handle_line(line)) | ||
227 | exit(1); | ||
228 | } | ||
229 | |||
230 | fclose(fh); | ||
231 | } | ||
232 | |||
210 | int | 233 | int |
211 | main(int argc, char **argv) | 234 | main(int argc, char **argv) |
212 | { | 235 | { |