Commit 4d569ae2 authored by Marek Vasut's avatar Marek Vasut

mxssb: Save line number alongside command line

Save the number at which line the command was. This will help when
reporting errors from the parser.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent a1efec28
......@@ -47,6 +47,7 @@ struct sb_cmd_list {
struct sb_cmd_list *next;
char *cmd;
size_t len;
unsigned int lineno;
};
struct sb_cmd_ctx {
......@@ -935,12 +936,11 @@ static int sb_fixup_sections_and_tags(struct sb_image_ctx *ictx)
static int sb_load_cmdfile(struct sb_image_ctx *ictx)
{
struct sb_cmd_list *head = NULL, *prev = NULL, *curr;
int fd;
int fd, lineno = 1;
FILE *fp;
char *line = NULL;
ssize_t rlen;
size_t len = 0;
size_t len;
fd = open(ictx->cfg_filename, O_RDONLY);
if (fd < 0)
......@@ -959,6 +959,7 @@ static int sb_load_cmdfile(struct sb_image_ctx *ictx)
curr->cmd = line;
curr->len = rlen;
curr->lineno = lineno++;
line[rlen - 1] = 0;
if (prev)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment