cname = p->config->name;
sname = p->name;
+ printf("%s.%s=%s\n", cname, sname, p->type);
uci_foreach_entry(option, &p->options, o) {
printf("%s.%s.%s=%s\n", cname, sname, o->name, o->value);
}
struct uci_context *ctx = cfg->ctx;
UCI_TRAP_SAVE(ctx, error);
+ cfg->n_section++;
section = (struct uci_section *) uci_malloc(ctx, sizeof(struct uci_section));
section->config = cfg;
uci_list_init(§ion->list);
uci_list_init(§ion->options);
section->type = uci_strdup(ctx, type);
- if (name)
+ if (name && name[0])
section->name = uci_strdup(ctx, name);
+ else
+ asprintf(§ion->name, "cfg%d", cfg->n_section);
uci_list_add(&cfg->sections, §ion->list);
UCI_TRAP_RESTORE(ctx);