build_message(
    char *file,
    int   line,
    int   code,
    int   severity,
    int   nb,
    ...)
{
   message_t *message = g_new0(message_t, 1);
   va_list marker;
   int     i, j;

   message->file = g_strdup(file);
   message->line = line;
   message->process = g_strdup(get_pname());
   message->running_on = g_strdup(get_running_on());
   message->component = g_strdup(get_pcomponent());
   message->module = g_strdup(get_pmodule());
   message->code = code;
   message->severity = severity;
   message->argument_allocated = nb+1,
   message->arg_array = g_new0(message_arg_array_t, nb+2);

   va_start(marker, nb);     /* Initialize variable arguments. */
   for (i = 0,j = 0; i < nb; i++) {
	char *key = va_arg(marker, char *);
	if (strcmp(key,"errno") == 0) {
	    int m_errno = va_arg(marker, int);
	    message->merrno = m_errno;
	    message->errnocode = errcode[m_errno];
	    message->errnostr = g_strdup(strerror(m_errno));
	} else {
            message->arg_array[j].key = g_strdup(key);
	    message->arg_array[j].value.type = MESSAGE_STRING;
            message->arg_array[j].value.string = g_strdup(va_arg(marker, char *));
	    j++;
	}
   }
   message->arg_array[j].key = NULL;
   message->arg_array[j].value.type = MESSAGE_NULL;
   message->arg_array[j].value.string = NULL;
   va_end( marker );

   set_message(message, 0);

   g_debug("new message: %s:%d:%d:%d %s", message->file, message->line, message->severity, message->code, message->msg);
   return message;
}
build_message(
    char *file,
    int   line,
    int   code,
    int   severity,
    int   nb,
    ...)
{
   message_t *message = g_new0(message_t, 1);
   va_list marker;
   int     i, j;

   message->file = g_strdup(file);
   message->line = line;
   message->process = g_strdup(get_pname());
   message->running_on = g_strdup(get_running_on());
   message->component = g_strdup(get_pcomponent());
   message->module = g_strdup(get_pmodule());
   message->code = code;
   message->severity = severity;
   message->argument_allocated = nb+1,
   message->arg_array = g_new0(message_arg_array_t, nb+2);

   va_start(marker, nb);      
   for (i = 0,j = 0; i < nb; i++) {
	char *key = va_arg(marker, char *);
	if (strcmp(key,"errno") == 0) {
	    int m_errno = va_arg(marker, int);
	    message->merrno = m_errno;
	    message->errnocode = errcode[m_errno];
	    message->errnostr = g_strdup(strerror(m_errno));
	} else {
            message->arg_array[j].key = g_strdup(key);
	    message->arg_array[j].value.type = MESSAGE_STRING;
            message->arg_array[j].value.string = g_strdup(va_arg(marker, char *));
	    j++;
	}
   }
   message->arg_array[j].key = NULL;
   message->arg_array[j].value.type = MESSAGE_NULL;
   message->arg_array[j].value.string = NULL;
   va_end( marker );

   set_message(message, 0);

   g_debug("new message: %s:%d:%d:%d %s", message->file, message->line, message->severity, message->code, message->msg);
   return message;
}