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