cleanup
[project/uci.git] / libuci.c
index 4985a33..da2d15e 100644 (file)
--- a/libuci.c
+++ b/libuci.c
@@ -56,10 +56,13 @@ struct uci_context *uci_alloc_context(void)
        memset(ctx, 0, sizeof(struct uci_context));
        uci_list_init(&ctx->root);
        uci_list_init(&ctx->history_path);
+       uci_list_init(&ctx->backends);
        ctx->flags = UCI_FLAG_STRICT;
 
        ctx->confdir = (char *) uci_confdir;
        ctx->savedir = (char *) uci_savedir;
+
+       uci_list_add(&ctx->backends, &uci_file_backend.e.list);
        ctx->backend = &uci_file_backend;
 
        return ctx;
@@ -158,6 +161,15 @@ void uci_perror(struct uci_context *ctx, const char *prefix)
        }
 }
 
+int uci_list_configs(struct uci_context *ctx, char ***list)
+{
+       UCI_HANDLE_ERR(ctx);
+       UCI_ASSERT(ctx, list != NULL);
+       UCI_ASSERT(ctx, ctx->backend && ctx->backend->list_configs);
+       *list = ctx->backend->list_configs(ctx);
+       return 0;
+}
+
 int uci_commit(struct uci_context *ctx, struct uci_package **package, bool overwrite)
 {
        UCI_HANDLE_ERR(ctx);