+static void uci_delta_save(struct uci_context *ctx, FILE *f,
+ const char *name, const struct uci_delta *h)
+{
+ const struct uci_element *e = &h->e;
+ char prefix[2] = {0, 0};
+
+ if (h->cmd <= __UCI_CMD_LAST)
+ prefix[0] = uci_command_char[h->cmd];
+
+ fprintf(f, "%s%s.%s", prefix, name, h->section);
+ if (e->name)
+ fprintf(f, ".%s", e->name);
+
+ if (h->cmd == UCI_CMD_REMOVE && !h->value)
+ fprintf(f, "\n");
+ else {
+ int i;
+
+ fprintf(f, "='");
+ for (i = 0; h->value[i]; i++) {
+ unsigned char c = h->value[i];
+ if (c != '\'')
+ fputc(c, f);
+ else
+ fprintf(f, "'\\''");
+ }
+ fprintf(f, "'\n");
+ }
+}