diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-12 00:29:28 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | d663f702c0e4fa562783504a483dce8f362d628e (patch) | |
tree | fdb656d0467a935aa6790dd9e05d3e373606a3e1 /controller/ctl-config.c | |
parent | 75cfbf3d0206f12422091e6479c508c69445bf4a (diff) |
Progression on config parsing.
Change-Id: Idd8d8987ccabef381f6d79c1d508930a2d4bae3c
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'controller/ctl-config.c')
-rw-r--r-- | controller/ctl-config.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/controller/ctl-config.c b/controller/ctl-config.c index 2e3fc40..95f6db8 100644 --- a/controller/ctl-config.c +++ b/controller/ctl-config.c @@ -28,8 +28,8 @@ // Load control config file -PUBLIC char* CtlConfigSearch(const char *dirList) { - int index, err; +char* CtlConfigSearch(const char *dirList) { + int index; char controlFile [CONTROL_MAXPATH_LEN]; strncpy(controlFile, CONTROL_CONFIG_PRE "-", CONTROL_MAXPATH_LEN); @@ -44,7 +44,7 @@ PUBLIC char* CtlConfigSearch(const char *dirList) { char *filename; char*fullpath; - err = wrap_json_unpack(entryJ, "{s:s, s:s !}", "fullpath", &fullpath, "filename", &filename); + int err = wrap_json_unpack(entryJ, "{s:s, s:s !}", "fullpath", &fullpath, "filename", &filename); if (err) { AFB_ERROR("CTL-INIT HOOPs invalid JSON entry= %s", json_object_get_string(entryJ)); return NULL; @@ -65,7 +65,7 @@ PUBLIC char* CtlConfigSearch(const char *dirList) { return NULL; } -PUBLIC int CtlConfigExec(CtlConfigT *ctlConfig) { +int CtlConfigExec(CtlConfigT *ctlConfig) { // best effort to initialise everything before starting if (ctlConfig->requireJ) { @@ -102,7 +102,7 @@ OnErrorExit: return 1; } -PUBLIC CtlConfigT *CtlConfigLoad(const char* filepath, CtlSectionT *sections) { +CtlConfigT *CtlConfigLoad(const char* filepath, CtlSectionT *sections) { json_object *ctlConfigJ; CtlConfigT *ctlConfig = calloc(1, sizeof (CtlConfigT)); int err; @@ -112,7 +112,7 @@ PUBLIC CtlConfigT *CtlConfigLoad(const char* filepath, CtlSectionT *sections) { if (err) goto OnErrorExit; #endif - // Search for config in filepath + // Search for config in filepath filepath = CtlConfigSearch(filepath); if (!filepath) { @@ -145,7 +145,7 @@ PUBLIC CtlConfigT *CtlConfigLoad(const char* filepath, CtlSectionT *sections) { err = afb_daemon_rename_api(ctlConfig->api); if (err) AFB_WARNING("Fail to rename api to:%s", ctlConfig->api); } - + } //load config sections |