parse comments properly
authorFelix Fietkau <nbd@openwrt.org>
Sun, 3 Feb 2008 01:56:41 +0000 (02:56 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 3 Feb 2008 01:56:41 +0000 (02:56 +0100)
file.c

diff --git a/file.c b/file.c
index 23ea9595974826c8a8cf85fb37909794c12d4a00..4b607f803aa283b8baa77caeb547f7a9fc65ca6d 100644 (file)
--- a/file.c
+++ b/file.c
@@ -210,6 +210,9 @@ static void parse_str(struct uci_context *ctx, char **str, char **target)
                case '"':
                        parse_double_quote(ctx, str, target);
                        break;
+               case '#':
+                       **str = 0;
+                       /* fall through */
                case 0:
                        goto done;
                case '\\':
@@ -451,6 +454,8 @@ static void uci_parse_line(struct uci_context *ctx, bool single)
                word = strtok_r(word, " \t", &pbrk);
 
                switch(word[0]) {
+                       case '#':
+                               return;
                        case 'p':
                                if ((word[1] == 0) || !strcmp(word + 1, "ackage"))
                                        uci_parse_package(ctx, &word, single);