static void uci_show_file(const char *name)
{
- uci_load(ctx, name);
+ struct uci_config *cfg;
+ uci_load(ctx, name, &cfg);
uci_unload(ctx, name);
}
}
}
-int uci_load(struct uci_context *ctx, const char *name)
+int uci_load(struct uci_context *ctx, const char *name, struct uci_config **cfg)
{
struct uci_parse_context *pctx;
struct stat statbuf;
/* add to main config file list */
uci_list_add(&ctx->root, &pctx->cfg->list);
+ if (cfg)
+ *cfg = pctx->cfg;
+
pctx->cfg = NULL;
/* no error happened, we can get rid of the parser context now */
* @ctx: uci context
* @name: name of the config file (relative to the config directory)
*/
-extern int uci_load(struct uci_context *ctx, const char *name);
+extern int uci_load(struct uci_context *ctx, const char *name, struct uci_config **cfg);
/**
* uci_unload: Unload a config file from the uci context