diff options
Diffstat (limited to 'lib/error.c')
-rw-r--r-- | lib/error.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 <stdarg.h> #include <stdio.h> -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'); } |