X-Git-Url: http://git.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=file.c;h=4098e59b6075ce29d7df154490c291855114a638;hp=ae0008f40f0185cd3e2d4916002c95453f079df2;hb=cac9b1d765338466c1c77719c4119c565689b4c4;hpb=a05278ae05df910e6a3a450d862fc1b53f138eb7 diff --git a/file.c b/file.c index ae0008f..4098e59 100644 --- a/file.c +++ b/file.c @@ -275,8 +275,15 @@ static void uci_export_package(struct uci_package *p, FILE *stream, bool header) fprintf(stream, "\n"); uci_foreach_element(&sec->options, o) { struct uci_option *opt = uci_to_option(o); - fprintf(stream, "\toption '%s'", uci_escape(ctx, opt->e.name)); - fprintf(stream, " '%s'\n", uci_escape(ctx, opt->value)); + switch(o->type) { + case UCI_TYPE_STRING: + fprintf(stream, "\toption '%s'", uci_escape(ctx, opt->e.name)); + fprintf(stream, " '%s'\n", uci_escape(ctx, opt->v.string)); + break; + default: + fprintf(stream, "\t# unknown type for option '%s'\n", uci_escape(ctx, opt->e.name)); + break; + } } } fprintf(stream, "\n");