-int uci_load(struct uci_context *ctx, const char *name, struct uci_package **package)
-{
- char *filename;
- bool confdir;
- FILE *file = NULL;
-
- UCI_HANDLE_ERR(ctx);
-
- switch (name[0]) {
- case '.':
- /* relative path outside of /etc/config */
- if (name[1] != '/')
- UCI_THROW(ctx, UCI_ERR_NOTFOUND);
- /* fall through */
- case '/':
- /* absolute path outside of /etc/config */
- filename = uci_strdup(ctx, name);
- name = strrchr(name, '/') + 1;
- confdir = false;
- break;
- default:
- /* config in /etc/config */
- filename = uci_config_path(ctx, name);
- confdir = true;
- break;
- }
-
- file = uci_open_stream(ctx, filename, SEEK_SET, false, false);
- ctx->errno = 0;
- UCI_TRAP_SAVE(ctx, done);
- UCI_INTERNAL(uci_import, ctx, file, name, package, true);
- UCI_TRAP_RESTORE(ctx);
-
- if (*package) {
- (*package)->path = filename;
- (*package)->confdir = confdir;
- uci_load_history(ctx, *package, false);
- }
-
-done:
- uci_close_stream(file);
- return ctx->errno;
-}
-
-int uci_commit(struct uci_context *ctx, struct uci_package **package, bool overwrite)