Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/linux-sunxi/sunxi-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <osp@andrep.de>2022-02-23 04:06:43 +0300
committerAndre Przywara <osp@andrep.de>2022-02-23 04:08:46 +0300
commita8013395e63b8b9fad7895a791656bd400c931c8 (patch)
tree0c140ea922d214acfc9894fefdfc3837452936f8
parentedec4d2f6c071c5aadbd7e0075abdafb4031e6d7 (diff)
fex: handle trailing semicolons
Some .fex files (for instance those for the H6 in sunxi-boards) contain a trailing semicolon on some lines, after the end quote of a string value. This confuses the parser and messes up our "make check" tests, so remove the semicolon both in the parser, but also in the unify-fex test conditioning tool, to make the tests pass. Signed-off-by: Andre Przywara <osp@andrep.de>
-rw-r--r--script_fex.c4
-rw-r--r--tests/unify-fex.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/script_fex.c b/script_fex.c
index 2c840d4..ec251c2 100644
--- a/script_fex.c
+++ b/script_fex.c
@@ -200,6 +200,10 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
pe = rtrim(s, pe);
+ /* Some lines end in a trailing semicolon. */
+ if (pe > s && pe[-1] == ';')
+ *--pe = '\0';
+
if (pe == s || *s == ';' || *s == '#')
continue; /* empty */
if (*s == ':') {
diff --git a/tests/unify-fex.c b/tests/unify-fex.c
index a1ff548..57da1c2 100644
--- a/tests/unify-fex.c
+++ b/tests/unify-fex.c
@@ -127,6 +127,10 @@ int main(int argc, char **argv)
sprintf(p, "\"%s\"", c);
free(c);
}
+ /* Remove a trailing semicolon. */
+ c = strchr(p, 0);
+ if (*--c == ';')
+ *c = '\0';
}
}
}