Section names, option names, list names can only be identifiers, so they don't need...
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 24 Feb 2012 11:24:17 +0000 (12:24 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 24 Feb 2012 11:24:17 +0000 (12:24 +0100)
Strip quotes except from values.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
file.c

diff --git a/file.c b/file.c
index 3cd0133..b471307 100644 (file)
--- a/file.c
+++ b/file.c
@@ -561,23 +561,23 @@ static void uci_export_package(struct uci_package *p, FILE *stream, bool header)
        struct uci_element *s, *o, *i;
 
        if (header)
        struct uci_element *s, *o, *i;
 
        if (header)
-               fprintf(stream, "package '%s'\n", uci_escape(ctx, p->e.name));
+               fprintf(stream, "package %s\n", uci_escape(ctx, p->e.name));
        uci_foreach_element(&p->sections, s) {
                struct uci_section *sec = uci_to_section(s);
        uci_foreach_element(&p->sections, s) {
                struct uci_section *sec = uci_to_section(s);
-               fprintf(stream, "\nconfig '%s'", uci_escape(ctx, sec->type));
+               fprintf(stream, "\nconfig %s", uci_escape(ctx, sec->type));
                if (!sec->anonymous || (ctx->flags & UCI_FLAG_EXPORT_NAME))
                if (!sec->anonymous || (ctx->flags & UCI_FLAG_EXPORT_NAME))
-                       fprintf(stream, " '%s'", uci_escape(ctx, sec->e.name));
+                       fprintf(stream, " %s", uci_escape(ctx, sec->e.name));
                fprintf(stream, "\n");
                uci_foreach_element(&sec->options, o) {
                        struct uci_option *opt = uci_to_option(o);
                        switch(opt->type) {
                        case UCI_TYPE_STRING:
                fprintf(stream, "\n");
                uci_foreach_element(&sec->options, o) {
                        struct uci_option *opt = uci_to_option(o);
                        switch(opt->type) {
                        case UCI_TYPE_STRING:
-                               fprintf(stream, "\toption '%s'", uci_escape(ctx, opt->e.name));
+                               fprintf(stream, "\toption %s", uci_escape(ctx, opt->e.name));
                                fprintf(stream, " '%s'\n", uci_escape(ctx, opt->v.string));
                                break;
                        case UCI_TYPE_LIST:
                                uci_foreach_element(&opt->v.list, i) {
                                fprintf(stream, " '%s'\n", uci_escape(ctx, opt->v.string));
                                break;
                        case UCI_TYPE_LIST:
                                uci_foreach_element(&opt->v.list, i) {
-                                       fprintf(stream, "\tlist '%s'", uci_escape(ctx, opt->e.name));
+                                       fprintf(stream, "\tlist %s", uci_escape(ctx, opt->e.name));
                                        fprintf(stream, " '%s'\n", uci_escape(ctx, i->name));
                                }
                                break;
                                        fprintf(stream, " '%s'\n", uci_escape(ctx, i->name));
                                }
                                break;