diff options
author | David Lamparter <equinox@diac24.net> | 2013-03-25 22:08:41 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2013-03-25 22:08:41 +0100 |
commit | f5c47e42e40e980c51fa561ca8bb0beb421ae0c0 (patch) | |
tree | 92d5e10abd37aa81796774cb5689bd3953e0146c /cethcan/main.c | |
parent | a7e337c459b2b7284757127b64235579b061561c (diff) |
cethcan: more code
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; } |