extern int uci_lookup(struct uci_context *ctx, struct uci_element **res, char *package, char *section, char *option);
/**
+ * uci_set_element_value: Replace an element's value with a new one
+ * @ctx: uci context
+ * @element: pointer to an uci_element struct pointer
+ * @value: new value
+ *
+ * Only valid for uci_option and uci_section. Will replace the type string
+ * when used with an uci_section
+ */
+extern int uci_set_element_value(struct uci_context *ctx, struct uci_element **element, char *value);
+
+/**
+ * uci_set: Set an element's value; create the element if necessary
+ * @ctx: uci context
+ * @package: package name
+ * @section: section name
+ * @option: option name
+ * @value: value (option) or type (section)
+ */
+extern int uci_set(struct uci_context *ctx, char *package, char *section, char *option, char *value);
+
+/**
* uci_list_configs: List available uci config files
*
* @ctx: uci context
/* private: */
int errno;
+ const char *func;
jmp_buf trap;
char *buf;
int bufsz;
struct uci_context *ctx;
/* private: */
int n_section;
+ struct uci_list history;
};
struct uci_section
{
struct uci_list list;
enum uci_command cmd;
- union {
- struct uci_element element;
- struct uci_package package;
- struct uci_section section;
- struct uci_option option;
- } data;
+ char *section;
+ char *option;
+ char *value;
};
/* linked list handling */
&_ptr->list != (_list); \
_ptr = _tmp, _tmp = list_to_element(_ptr->list.next))
-/* returns true if a list is empty */
+/**
+ * uci_list_empty: returns true if a list is empty
+ * @list: list head
+ */
#define uci_list_empty(list) ((list)->next == (list))
/* wrappers for dynamic type handling */