From 3b0a87254f8a1e48a155f5571c274297353a0106 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 20 Sep 2024 20:46:37 -0400 Subject: start mld, add loading of object files, add fuzzing support --- lib/error.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/error.c b/lib/error.c index 352a60d..3d88234 100644 --- a/lib/error.c +++ b/lib/error.c @@ -2,8 +2,8 @@ #include #include -char *current_file = "file.asm"; -int log_disabled = 1; +char *current_file = NULL; +int log_disabled = 0; __attribute__((format(printf, 4, 5))) void __log_impl_pos(int line, int column, int type, const char *format, ...) @@ -27,7 +27,10 @@ void __log_impl_pos(int line, int column, int type, const char *format, ...) break; } - printf("%s:%d:%d: %s ", current_file, line, column, t); + if (current_file != NULL) + printf("%s:%d:%d: %s ", current_file, line, column, t); + else + printf("%s ", t); vprintf(format, list); putchar('\n'); } @@ -54,7 +57,10 @@ void __log_impl(int type, const char *format, ...) break; } - printf("%s ", t); + if (current_file != NULL) + printf("%s: %s ", current_file, t); + else + printf("%s ", t); vprintf(format, list); putchar('\n'); } -- cgit v1.2.3-freya