diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-03-25 11:38:24 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-03-25 11:38:24 -0400 |
commit | 7676f7d22edae31996e0651e608b2b60dfa5da0b (patch) | |
tree | 21ccdcda1ce6accefc2597cf578a2c180d5764fb /tools/scan_includes.c | |
parent | 0447ee0cf95d2defb9a202def65288aa5bf1410b (diff) | |
parent | 0c446367ce79dfe2a26f4bd7668036477811a279 (diff) |
Merge branch 'master' of https://github.com/pret/pokecrystal
Diffstat (limited to 'tools/scan_includes.c')
-rw-r--r-- | tools/scan_includes.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/scan_includes.c b/tools/scan_includes.c index 2babdcfb5..63af3bcfb 100644 --- a/tools/scan_includes.c +++ b/tools/scan_includes.c @@ -48,9 +48,20 @@ void scan_file(char* filename) { buffer = strchr(buffer, '\n'); if (!buffer) { fprintf(stderr, "%s: no newline at end of file\n", filename); + break; } break; + case '"': + buffer++; + buffer = strchr(buffer, '"'); + if (!buffer) { + fprintf(stderr, "%s: unterminated string\n", filename); + break; + } + buffer++; + break; + case 'i': case 'I': if ((strncmp(buffer, "INCBIN", 6) == 0) || (strncmp(buffer, "incbin", 6) == 0)) { @@ -60,9 +71,10 @@ void scan_file(char* filename) { } if (is_incbin || is_include) { buffer = strchr(buffer, '"'); - if (!buffer++) { + if (!buffer) { break; } + buffer++; int length = strcspn(buffer, "\""); char *include = malloc(length + 1); strncpy(include, buffer, length); |