From 1b5e4f4ba195ad4ed02cfac6129c386c4aeaf7cd Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 25 Mar 2013 23:01:50 +0100 Subject: cethcan: more code --- cethcan/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cethcan/main.c') diff --git a/cethcan/main.c b/cethcan/main.c index 6d79a9f..0794254 100644 --- a/cethcan/main.c +++ b/cethcan/main.c @@ -7,7 +7,7 @@ int main(int argc, char **argv) int optch = 0; const char *cfgfile = "cethcan.json"; json_error_t je; - json_t *config, *ethercfg; + json_t *config, *ethercfg, *lightcfg; do { optch = getopt(argc, argv, "c:"); @@ -47,6 +47,13 @@ int main(int argc, char **argv) return 1; } + lightcfg = json_object_get(config, "lights"); + for (size_t i = 0; i < json_array_size(lightcfg); i++) { + json_t *c = json_array_get(lightcfg, i); + if (light_init_conf(c)) + return 1; + } + event_base_loop(ev_base, 0); return 0; } -- cgit v1.2.1