diff options
Diffstat (limited to 'cethcan/main.c')
-rw-r--r-- | cethcan/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cethcan/main.c b/cethcan/main.c index 938721e..6d79a9f 100644 --- a/cethcan/main.c +++ b/cethcan/main.c @@ -1,13 +1,13 @@ #include "cethcan.h" struct event_base *ev_base; -json_t *config; int main(int argc, char **argv) { int optch = 0; const char *cfgfile = "cethcan.json"; json_error_t je; + json_t *config, *ethercfg; do { optch = getopt(argc, argv, "c:"); @@ -40,6 +40,13 @@ int main(int argc, char **argv) can_init(); + ethercfg = json_object_get(config, "ethernet"); + for (size_t i = 0; i < json_array_size(ethercfg); i++) { + json_t *c = json_array_get(ethercfg, i); + if (ether_init(c)) + return 1; + } + event_base_loop(ev_base, 0); return 0; } |