diff options
author | RavRabbit <RavRabbit@users.noreply.github.com> | 2017-06-07 19:00:28 +0300 |
---|---|---|
committer | Andre Przywara <osp@andrep.de> | 2022-02-18 18:21:46 +0300 |
commit | edec4d2f6c071c5aadbd7e0075abdafb4031e6d7 (patch) | |
tree | f9b5c854bc78ad96870d8417c7719659c387ecc8 | |
parent | 34da6cf5b9eb036050423eb7c7668b478af1af35 (diff) |
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>
-rw-r--r-- | script_bin.c | 2 | ||||
-rw-r--r-- | script_fex.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/script_bin.c b/script_bin.c index 9c63084..ebed175 100644 --- a/script_bin.c +++ b/script_bin.c @@ -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; diff --git a/script_fex.c b/script_fex.c index 0288560..2c840d4 100644 --- a/script_fex.c +++ b/script_fex.c @@ -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); |