summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@bauklotz.fritz.box>2016-08-12 22:36:25 +0200
committererdgeist <erdgeist@bauklotz.fritz.box>2016-08-12 22:36:25 +0200
commit879e2d68fefc407bfbf41dfbc0d68d52c9b46bc7 (patch)
treec147611f1b537f2b0a3e52d3d9f2fb421666b491
parentb489ca48635a2d58ed99ad6b2cf34183c197c019 (diff)
feed config line by line to parser
-rw-r--r--main-sdl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/main-sdl.c b/main-sdl.c
index 1f6d92d..bb31720 100644
--- a/main-sdl.c
+++ b/main-sdl.c
@@ -207,6 +207,29 @@ worker(void *args)
207 } 207 }
208} 208}
209 209
210static void
211config_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
210int 233int
211main(int argc, char **argv) 234main(int argc, char **argv)
212{ 235{