Commit ea338438 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Use color_(v)eprintf functions in order to display colors only when the terminal is ansi

parent 64b0bd9c
......@@ -59,8 +59,8 @@ void print_warning(const char *name_of_file, const char* name_of_function, int n
{
va_list arguments;
va_start(arguments, message);
color_fprintf(BLC_YELLOW, stderr, "\n%s: %s \t %s \t %i :\nWarning: ", blc_program_name, name_of_file, name_of_function, numero_of_line);
color_vfprintf(BLC_YELLOW, stderr, message, arguments);
color_eprintf(BLC_YELLOW, "\n%s: %s \t %s \t %i :\nWarning: ", blc_program_name, name_of_file, name_of_function, numero_of_line);
color_veprintf(BLC_YELLOW, message, arguments);
fprintf(stderr, "\n\n");
fflush(stderr);
va_end(arguments);
......@@ -71,8 +71,8 @@ void print_system_error(const char *name_of_file, const char* name_of_function,
{
va_list arguments;
va_start(arguments, message);
color_fprintf(BLC_BRIGHT_RED, stderr, "\n%s: %s \t %s \t %i :\nSystem error: %s\n", blc_program_name, name_of_file, name_of_function, numero_of_line, strerror(errno));
color_vfprintf(BLC_BRIGHT_RED, stderr, message, arguments);
color_eprintf(BLC_BRIGHT_RED, "\n%s: %s \t %s \t %i :\nSystem error: %s\n", blc_program_name, name_of_file, name_of_function, numero_of_line, strerror(errno));
color_veprintf(BLC_BRIGHT_RED, message, arguments);
fprintf(stderr, "\n\n");
fflush(stderr);
va_end(arguments);
......@@ -97,9 +97,9 @@ void fatal_system_error(const char *name_of_file, const char* name_of_function,
{
va_list arguments;
va_start(arguments, message);
color_fprintf(BLC_BRIGHT_RED, stderr, "\n%s: %s \t %i:%s\n", blc_program_name, name_of_file, numero_of_line, name_of_function);
color_fprintf(BLC_BRIGHT_RED, stderr, "System error: %s\n", strerror(errno));
color_vfprintf(BLC_BRIGHT_RED, stderr, message, arguments);
color_eprintf(BLC_BRIGHT_RED, "\n%s: %s \t %i:%s\n", blc_program_name, name_of_file, numero_of_line, name_of_function);
color_eprintf(BLC_BRIGHT_RED, "System error: %s\n", strerror(errno));
color_veprintf(BLC_BRIGHT_RED, message, arguments);
va_end(arguments);
fprintf(stderr, "\n");
fflush(stderr);
......@@ -111,10 +111,10 @@ void fatal_command_system_error(const char *name_of_file, const char* name_of_fu
{
va_list arguments;
va_start(arguments, message);
color_fprintf(BLC_BRIGHT_RED, stderr, "\n%s: %s \t %i:%s\n", blc_program_name, name_of_file, numero_of_line, name_of_function);
color_eprintf(BLC_BRIGHT_RED, "\n%s: %s \t %i:%s\n", blc_program_name, name_of_file, numero_of_line, name_of_function);
fprintf(stderr, "Executing: %s\n", command);
color_fprintf(BLC_BRIGHT_RED, stderr, "System error: %s\n", strerror(errno));
color_vfprintf(BLC_BRIGHT_RED, stderr, message, arguments);
color_eprintf(BLC_BRIGHT_RED, "System error: %s\n", strerror(errno));
color_veprintf(BLC_BRIGHT_RED, message, arguments);
va_end(arguments);
fprintf(stderr, "\n\n");
fflush(stderr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment