add convenience functions for looking up packages/sections/options
[project/uci.git] / list.c
diff --git a/list.c b/list.c
index 99179712e8b88c6b567ca04e1b9046edcd8b3b33..a336b84aff7569223d1ec1c9546506df9aa7c5e7 100644 (file)
--- a/list.c
+++ b/list.c
@@ -357,6 +357,18 @@ done:
        return e;
 }
 
+int
+uci_lookup_next(struct uci_context *ctx, struct uci_element **e, struct uci_list *list, const char *name)
+{
+       UCI_HANDLE_ERR(ctx);
+
+       *e = uci_lookup_list(list, name);
+       if (!*e)
+               UCI_THROW(ctx, UCI_ERR_NOTFOUND);
+
+       return 0;
+}
+
 int
 uci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *str, bool extended)
 {