mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup error printing routines
Clean up so that only the following error related printing functions are used: tio_error_printf(), tio_error_printf_silent(), tio_warning_printf(). A session mode switch is introduced for error printing so that it will print error messages with better formatting depending on in or out of session.
This commit is contained in:
parent
73a30a89ef
commit
ac859f41b9
9 changed files with 122 additions and 77 deletions
24
src/print.h
24
src/print.h
|
|
@ -56,7 +56,7 @@ extern char ansi_format[];
|
|||
fprintf (stdout, "%s" format ANSI_RESET, ansi_format, ## args); \
|
||||
}
|
||||
|
||||
#define warning_printf(format, args...) \
|
||||
#define tio_warning_printf(format, args...) \
|
||||
{ \
|
||||
if (print_tainted) \
|
||||
putchar('\n'); \
|
||||
|
|
@ -74,28 +74,14 @@ extern char ansi_format[];
|
|||
print_tainted = false; \
|
||||
}
|
||||
|
||||
#define tio_error_printf(format, args...) \
|
||||
{ \
|
||||
if (print_tainted) \
|
||||
putchar('\n'); \
|
||||
ansi_error_printf("[%s] " format, current_time(), ## args); \
|
||||
print_tainted = false; \
|
||||
}
|
||||
|
||||
#define error_printf(format, args...) \
|
||||
snprintf(error[0], 1000, format, ## args);
|
||||
|
||||
#define error_printf_silent(format, args...) \
|
||||
snprintf(error[1], 1000, format, ## args);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define debug_printf(format, args...) \
|
||||
#define tio_debug_printf(format, args...) \
|
||||
fprintf (stdout, "[debug] " format, ## args)
|
||||
#define debug_printf_raw(format, args...) \
|
||||
#define tio_debug_printf_raw(format, args...) \
|
||||
fprintf (stdout, "" format, ## args)
|
||||
#else
|
||||
#define debug_printf(format, args...)
|
||||
#define debug_printf_raw(format, args...)
|
||||
#define tio_debug_printf(format, args...)
|
||||
#define tio_debug_printf_raw(format, args...)
|
||||
#endif
|
||||
|
||||
void print_hex(char c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue