- cname = p->package->e.name;
- sname = p->e.name;
- printf("%s.%s=%s\n", cname, sname, p->type);
- uci_foreach_element(&p->options, e) {
- uci_show_option(uci_to_option(e));
+ switch(o->type) {
+ case UCI_TYPE_STRING:
+ if (quote)
+ uci_print_value(stdout, o->v.string);
+ else
+ printf("%s", o->v.string);
+ printf("\n");
+ break;
+ case UCI_TYPE_LIST:
+ uci_foreach_element(&o->v.list, e) {
+ printf("%s", (sep ? delimiter : ""));
+ space = strpbrk(e->name, " \t\r\n");
+ if (!space && !quote)
+ printf("%s", e->name);
+ else
+ uci_print_value(stdout, e->name);
+ sep = true;
+ }
+ printf("\n");
+ break;
+ default:
+ printf("<unknown>\n");
+ break;
+ }
+}
+
+static void uci_show_option(struct uci_option *o, bool quote)
+{
+ printf("%s.%s.%s=",
+ o->section->package->e.name,
+ (cur_section_ref ? cur_section_ref : o->section->e.name),
+ o->e.name);
+ uci_show_value(o, quote);
+}
+
+static void uci_show_section(struct uci_section *s)
+{
+ struct uci_element *e;
+ const char *cname;
+ const char *sname;
+
+ cname = s->package->e.name;
+ sname = (cur_section_ref ? cur_section_ref : s->e.name);
+ printf("%s.%s=%s\n", cname, sname, s->type);
+ uci_foreach_element(&s->options, e) {
+ uci_show_option(uci_to_option(e), true);