single printf during error

This commit is contained in:
Igor Malovitsa 2024-03-06 10:59:30 +02:00
parent 4283c17739
commit c8704163cd

7
hbas.c
View file

@ -878,10 +878,9 @@ int main(int argc, char **argv) {
err = assemble(ht, input.buf, input.len, &out, &einfo); err = assemble(ht, input.buf, input.len, &out, &einfo);
if (err != 0) { if (err != 0) {
size_t column = einfo.token.start - einfo.line_start + 1; size_t column = einfo.token.start - einfo.line_start + 1;
fprintf(stderr, "failed to assemble, %s, line=%zu, col=%zu token=", fprintf(stderr, "failed to assemble, %s, line=%zu, col=%zu token=%.*s\n",
ERRORS[err], einfo.line, column); ERRORS[err], einfo.line, column,
fwrite(&input.buf[einfo.token.start], 1, einfo.token.len, stderr); (int)einfo.token.len, &input.buf[einfo.token.start]);
fprintf(stderr, "\n");
goto done; goto done;
} }
if (hex_out) { if (hex_out) {