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>
This commit is contained in:
Andre Przywara 2022-02-23 01:06:43 +00:00
parent edec4d2f6c
commit a8013395e6
2 changed files with 8 additions and 0 deletions

View File

@ -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 == ':') {

View File

@ -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';
}
}
}