/************************************************************************/
/*	Routing Protocol Simulator	Release 1.0	1994/3/17	*/
/*                                              1.21    1997/2/10       */
/*									*/
/*		module 	: common routine	       			*/
/*		file	: rps_log.c		       			*/
/*									*/
/*   Copyright (c) 1994-1997 by Systems Development Laboratory Hitachi,	*/
/*   Ltd. All rights reserved.						*/
/*----------------------------------------------------------------------*/
/*	UPDATE HISTORY							*/
/*									*/
/************************************************************************/
static char copyright[]=
  "@(#)Copyright (c) 1994-1997 by Systems Development Laboratory Hitachi,Ltd.\n All rights researved.\n";

#ifdef VXWORKS

#include "stdioLib.h"

typedef char *VA_LIST;

#define VA_DCL int va_alist;
#define VA_START(list) list = (char *)&va_alist
#define VA_END(list)
#define VA_ARG(list,mode) ((mode *)(list += sizeof(mode)))[-1]

#else

#include <stdio.h>
#include <varargs.h>

#endif

char log_buff[256];

/*

 log_trace

*/
void log_trace(va_alist)
#ifdef VXWORKS
VA_DCL
#else
va_dcl
#endif
{
    char *fmt;
    FILE *fp;

#ifdef VXWORKS

    VA_LIST args;

    VA_START(args);
    
    fp = VA_ARG(args,FILE *);
    fmt = VA_ARG(args,char *);

    bzero(log_buff,sizeof(log_buff));
    vsprintf(log_buff,fmt,args);

    VA_END(args);

#else

    va_list args;

    va_start(args);

    fp = va_arg(args,FILE *);
    fmt = va_arg(args,char *);

    bzero(log_buff,sizeof(log_buff));
    vsprintf(log_buff,fmt,args);

    va_end(args);

#endif   
    

/*    printf("fmt = %s\n",fmt);
    printf("args = %s\n",args);*/
    if(fp == NULL) fp = stderr;
    
/*    strcat(log_buff,"\0");*/

    fputs(log_buff,fp);
    fflush(fp);
}






