mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Redirect error messages to stderr
This commit is contained in:
parent
9bc6e34e82
commit
c7b27b022f
2 changed files with 16 additions and 2 deletions
|
|
@ -35,11 +35,11 @@ void error_exit(void)
|
|||
if (error[0][0] != 0)
|
||||
{
|
||||
/* Print error */
|
||||
tio_printf("Error: %s", error[0]);
|
||||
tio_error_printf("Error: %s", error[0]);
|
||||
}
|
||||
else if ((error[1][0] != 0) && (option.no_autoconnect))
|
||||
{
|
||||
/* Print silent error */
|
||||
tio_printf("Error: %s", error[1]);
|
||||
tio_error_printf("Error: %s", error[1]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
src/print.h
14
src/print.h
|
|
@ -36,6 +36,12 @@ extern char ansi_format[];
|
|||
fflush(stdout); \
|
||||
}
|
||||
|
||||
#define ansi_error_printf(format, args...) \
|
||||
{ \
|
||||
fprintf (stderr, "\r%s" format ANSI_RESET "\r\n", ansi_format, ## args); \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
#define ansi_printf_raw(format, args...) \
|
||||
{ \
|
||||
fprintf (stdout, "%s" format ANSI_RESET, ansi_format, ## args); \
|
||||
|
|
@ -56,6 +62,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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue