fex: add support for '-' and '/' characters

Newer fex files like orangepi_oneplus.fex from the sunxi-boards repo fail
conversion to the binary format:
--------------------------
E: orangepi_oneplus.fex:258: invalid character at 4.
--------------------------
This is because they contain a '-' character in section and key names, and
also '/' characters in some section names, which our compiler denies.

Relax the section and key filter to allow '-' and '/' as well.

Signed-off-by: Andre Przywara <osp@andrep.de>
This commit is contained in:
RavRabbit 2017-06-07 18:00:28 +02:00 committed by Andre Przywara
parent 34da6cf5b9
commit edec4d2f6c
2 changed files with 3 additions and 3 deletions

View File

@ -242,7 +242,7 @@ static int decompile_section(void *bin, size_t bin_size,
words = (entry->pattern >> 0) & 0xffff;
for (char *p = entry->name; *p; p++)
if (!(isalnum(*p) || *p == '_')) {
if (!(isalnum(*p) || *p == '_' || *p == '-')) {
pr_info("Warning: Malformed entry key \"%s\"\n",
entry->name);
break;

View File

@ -211,7 +211,7 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
if (*s == '[') {
/* section */
char *p = ++s;
while (isalnum(*p) || *p == '_')
while (isalnum(*p) || *p == '_' || *p == '-' || *p == '/')
p++;
if (*p == ']' && *(p+1) == '\0') {
@ -239,7 +239,7 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
goto parse_error;
};
while (isalnum(*p) || *p == '_')
while (isalnum(*p) || *p == '_' || *p == '-')
p++;
mark = p;
p = skip_blank(p);