Skip to content

Fail on empty line of s-record. #18

@bicyclesonthemoon

Description

@bicyclesonthemoon

Some tools produce s-record (or hex) files which have an additonal empty line(s) at the end.
rl78flash will not accept such otherwise perfectly valid file.

It makes much more sense to accept these files than having to edit each file every time a software is released.
Empty lines can be safely ignored.

I am dealing with it by skiping the line if first character is '\r' or '\n':
in srec.c:
if ('S' != line[0])
{
if ('\r' == line[0] || '\n' == line[0])
{
break;
}
fprintf(stderr, "File format error (\"%s\")\n", line);
rc = SREC_FORMAT_ERROR;
break;
}
(I don't know why github is misformatting the indentation)

similarly for intel hex:
if (':' != line[0])
{
if ('\r' == line[0] || '\n' == line[0])
{
break;
}
fprintf(stderr, "File format error (\"%s\")\n", line);
rc = SREC_FORMAT_ERROR;
break;
}

(BTW, I wrote some questions in my pull request for intel hex support)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions