diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/colored_text.c | 10 | ||||
-rw-r--r-- | util/err.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/util/colored_text.c b/util/colored_text.c new file mode 100644 index 0000000..836f357 --- /dev/null +++ b/util/colored_text.c @@ -0,0 +1,10 @@ + +#define USE_COLORED_TEXT 1 + +#if USE_COLORED_TEXT +#define TEXT_ERROR(x) "\x1b[91m" x "\x1b[0m" +#define TEXT_IMPORTANT(x) "\x1b[1m" x "\x1b[0m" +#else +#define TEXT_ERROR(x) x +#define TEXT_IMPORTANT(x) x +#endif @@ -3,7 +3,7 @@ typedef uint32_t LineNo; static void err_print(LineNo line, LineNo col, const char *fmt, ...) { /* TODO: Color */ va_list args; - fprintf(stderr, "Error at line %lu col %lu:\n", (unsigned long)line, (unsigned long)col); + fprintf(stderr, TEXT_ERROR("error:") " at line %lu col %lu:\n", (unsigned long)line, (unsigned long)col); va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); |