Commit 73dcbdc3 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add blc_program_id. Both blc_program_name and blc_program_id are char cont*...

Add blc_program_id. Both blc_program_name and blc_program_id are char cont* and are initilized with empty string
parent 50476bb1
......@@ -241,7 +241,11 @@ MANY_REALLOCATIONS(&values, 7);
// If it has been initialise it points toward argv[0]. Useful to debug different program in parallel.
extern char *blc_program_name;
extern char const *blc_program_name;
//blc_program_name<pid>
extern char const *blc_program_id;
extern FILE *blc_log_file;
typedef unsigned char uchar;
......
......@@ -32,7 +32,9 @@
#include "blc_text.h"
FILE *blc_log_file = NULL;
char *blc_program_name=NULL;
char const *blc_program_name="";
char const *blc_program_id=""; //Name + pid
size_t blc_get_type_size(uint32_t type)
{
......@@ -58,7 +60,7 @@ void print_warning(const char *name_of_file, const char* name_of_function, int n
{
va_list arguments;
va_start(arguments, message);
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_eprintf(BLC_YELLOW, "\n%s: %s \t %s \t %i :\nWarning: ", blc_program_id, name_of_file, name_of_function, numero_of_line);
color_veprintf(BLC_YELLOW, message, arguments);
fprintf(stderr, "\n");
fflush(stderr);
......@@ -70,7 +72,7 @@ void print_system_error(const char *name_of_file, const char* name_of_function,
{
va_list arguments;
va_start(arguments, message);
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_eprintf(BLC_BRIGHT_RED, "\n%s: %s \t %s \t %i :\nSystem error: %s\n", blc_program_id, name_of_file, name_of_function, numero_of_line, strerror(errno));
color_veprintf(BLC_BRIGHT_RED, message, arguments);
fprintf(stderr, "\n");
fflush(stderr);
......@@ -82,7 +84,7 @@ void fatal_error(const char *name_of_file, const char* name_of_function, int num
{
va_list arguments;
va_start(arguments, message);
color_eprintf(BLC_BRIGHT_RED, "%s: %s \t %s \t %i :\nError: ", blc_program_name, name_of_file, name_of_function, numero_of_line);
color_eprintf(BLC_BRIGHT_RED, "%s: %s \t %s \t %i :\nError: ", blc_program_id, name_of_file, name_of_function, numero_of_line);
color_veprintf(BLC_BRIGHT_RED, message, arguments);
va_end(arguments);
fprintf(stderr, "\n");
......@@ -96,7 +98,7 @@ void fatal_system_error(const char *name_of_file, const char* name_of_function,
{
va_list arguments;
va_start(arguments, message);
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, "\n%s: %s \t %i:%s\n", blc_program_id, 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);
......@@ -110,7 +112,7 @@ void fatal_command_system_error(const char *name_of_file, const char* name_of_fu
{
va_list arguments;
va_start(arguments, message);
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, "\n%s: %s \t %i:%s\n", blc_program_id, name_of_file, numero_of_line, name_of_function);
fprintf(stderr, "Executing: %s\n", command);
color_eprintf(BLC_BRIGHT_RED, "System error: %s\n", strerror(errno));
color_veprintf(BLC_BRIGHT_RED, message, arguments);
......
Markdown is supported
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