Browse Source

make more functions available externally

Felix Fietkau 16 years ago
parent
commit
68ced4fb64
3 changed files with 17 additions and 4 deletions
  1. 2 2
      history.c
  2. 12 0
      libuci.c
  3. 3 2
      uci_internal.h

+ 2 - 2
history.c

@@ -27,7 +27,7 @@
 #include <ctype.h>
 
 /* record a change that was done to a package */
-static void
+void
 uci_add_history(struct uci_context *ctx, struct uci_list *list, int cmd, char *section, char *option, char *value)
 {
 	struct uci_history *h;
@@ -48,7 +48,7 @@ uci_add_history(struct uci_context *ctx, struct uci_list *list, int cmd, char *s
 	uci_list_add(list, &h->e.list);
 }
 
-static void
+void
 uci_free_history(struct uci_history *h)
 {
 	if (!h)

+ 12 - 0
libuci.c

@@ -193,6 +193,18 @@ int uci_load(struct uci_context *ctx, const char *name, struct uci_package **pac
 	return 0;
 }
 
+int uci_add_backend(struct uci_context *ctx, struct uci_backend *b)
+{
+	struct uci_element *e;
+	UCI_HANDLE_ERR(ctx);
+	e = uci_lookup_list(&ctx->backends, b->e.name);
+	if (e)
+		UCI_THROW(ctx, UCI_ERR_DUPLICATE);
+
+	uci_list_add(&ctx->backends, &b->e.list);
+	return 0;
+}
+
 int uci_set_backend(struct uci_context *ctx, const char *name)
 {
 	struct uci_element *e;

+ 3 - 2
uci_internal.h

@@ -32,8 +32,9 @@ struct uci_parse_context
 	int bufsz;
 };
 
-static void uci_add_history(struct uci_context *ctx, struct uci_list *list, int cmd, char *section, char *option, char *value);
-static void uci_free_history(struct uci_history *h);
+int uci_add_backend(struct uci_context *ctx, struct uci_backend *b);
+void uci_add_history(struct uci_context *ctx, struct uci_list *list, int cmd, char *section, char *option, char *value);
+void uci_free_history(struct uci_history *h);
 
 /*
  * functions for debug and error handling, for internal use only