From c8704163cd86876572c19c607a8b0c818d57c7a6 Mon Sep 17 00:00:00 2001 From: Igor Malovitsa Date: Wed, 6 Mar 2024 10:59:30 +0200 Subject: [PATCH] single printf during error --- hbas.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hbas.c b/hbas.c index 5b5da3f..f36909a 100644 --- a/hbas.c +++ b/hbas.c @@ -878,10 +878,9 @@ int main(int argc, char **argv) { err = assemble(ht, input.buf, input.len, &out, &einfo); if (err != 0) { size_t column = einfo.token.start - einfo.line_start + 1; - fprintf(stderr, "failed to assemble, %s, line=%zu, col=%zu token=", - ERRORS[err], einfo.line, column); - fwrite(&input.buf[einfo.token.start], 1, einfo.token.len, stderr); - fprintf(stderr, "\n"); + fprintf(stderr, "failed to assemble, %s, line=%zu, col=%zu token=%.*s\n", + ERRORS[err], einfo.line, column, + (int)einfo.token.len, &input.buf[einfo.token.start]); goto done; } if (hex_out) {