return rc;
}
-TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, struct dirent **cfg_files) {
+TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, int n, struct dirent **cfg_files) {
json_t *jcfg;
json_error_t rc;
- int n;
if ((!tr) || (!cfg_files))
return TR_CFG_BAD_PARAMS;
return NULL;
}
-#if 0
-json_t *tr_read_config (int n, struct dirent **cfg_files) {
- json_t *jcfg = NULL;
- json_t *temp = NULL;
- json_error_t err;
-
- if (!cfg_files)
- return NULL;
-
- while (n--) {
- fprintf(stderr, "tr_read_config: Parsing %s.\n", cfg_files[n]->d_name);
- if (NULL == (temp = json_load_file(cfg_files[n]->d_name, JSON_DISABLE_EOF_CHECK, &err))) {
- fprintf (stderr, "tr_read_config: Error parsing config file %s.\n", cfg_files[n]->d_name);
- return NULL;
- }
-
- if (!jcfg) {
- jcfg = temp;
- }else {
- if (-1 == json_object_update(jcfg, temp)) {
- fprintf(stderr, "tr_read_config: Error merging config information.\n");
- return NULL;
- }
- }
- }
-
- fprintf(stderr, "tr_read_config: Merged configuration complete:\n%s\n", json_dumps(jcfg, 0));
-
- return jcfg;
-}
-#endif
-
static int is_cfg_file(const struct dirent *dent) {
int n;
} TR_CFG;
int tr_find_config_files (struct dirent ***cfg_files);
-TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, struct dirent **cfg_files);
+TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, int n, struct dirent **cfg_files);
TR_CFG_RC tr_apply_new_config (TR_INSTANCE *tr);
TR_CFG_RC tr_cfg_validate (TR_CFG *trc);
void tr_cfg_free(TR_CFG *cfg);
{
TR_INSTANCE *tr = NULL;
struct dirent **cfg_files = NULL;
- json_t *jcfg = NULL;
TR_CFG_RC rc = TR_CFG_SUCCESS; /* presume success */
int err = 0, n = 0;;
exit(1);
}
- if (TR_CFG_SUCCESS != tr_parse_config(tr, cfg_files)) {
+ if (TR_CFG_SUCCESS != tr_parse_config(tr, n, cfg_files)) {
fprintf (stderr, "Error decoding configuration information, exiting.\n");
exit(1);
}