Skip to content

Commit

Permalink
syn: Tolerate DOS-style line endings in the Syntax Dictionary
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
terryburton committed Sep 26, 2024
1 parent 62fa1ee commit f35cd69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/c-lib/syn.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static struct aiEntry* parseSyntaxDictionaryFile(gs1_encoder* const ctx, const c
pos = sd;
linenum = 1;
while (fgets(buf, sizeof(buf), fp)) {
buf[strcspn(buf, "\n")] = 0; /* Chop newline */
buf[strcspn(buf, "\r\n")] = 0; /* Chop linefeed and newline */
if (parseSyntaxDictionaryEntry(ctx, buf, sd, &pos, cap) < 0) {
int s = snprintf(errbuf, sizeof(errbuf), "Syntax Dictionary line %d: %s", (int)linenum, ctx->errMsg);
if (s < (int)sizeof(errbuf))
Expand Down

0 comments on commit f35cd69

Please sign in to comment.