+static int uci_do_commit(int argc, char **argv)
+{
+ char **configs = NULL;
+ char **p;
+
+ if ((uci_list_configs(ctx, &configs) != UCI_OK) || !configs) {
+ uci_perror(ctx, appname);
+ return 1;
+ }
+
+ for (p = configs; *p; p++) {
+ if ((argc < 2) || !strcmp(argv[1], *p)) {
+ struct uci_package *package = NULL;
+ int ret;
+
+ if (uci_load(ctx, *p, &package) != UCI_OK) {
+ uci_perror(ctx, appname);
+ continue;
+ }
+ if (uci_commit(ctx, &package) != UCI_OK)
+ uci_perror(ctx, appname);
+
+ uci_unload(ctx, package);
+ }
+ }
+ return 0;
+}
+
+