2002-09-16 03:14:44 +00:00
|
|
|
#include <OS.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
static sem_id errorPrinting=0;
|
|
|
|
|
|
2002-12-15 07:05:38 +00:00
|
|
|
// Create a function for standardized formats. Wish I could get rid of the warning associated with this...
|
2002-09-16 03:14:44 +00:00
|
|
|
void error(char *fmt, ...)
|
|
|
|
|
{
|
|
|
|
|
if (errorPrinting==0)
|
|
|
|
|
errorPrinting=create_sem(1,"error_printing");
|
|
|
|
|
acquire_sem(errorPrinting);
|
|
|
|
|
va_list argp;
|
2002-11-19 04:05:16 +00:00
|
|
|
char tmp[2000];
|
2002-09-16 03:14:44 +00:00
|
|
|
sprintf(tmp, "[%lld] error: %s",real_time_clock_usecs(),fmt);
|
|
|
|
|
va_start(argp, tmp);
|
|
|
|
|
vfprintf(stderr,tmp,argp);
|
|
|
|
|
va_end(argp);
|
|
|
|
|
release_sem(errorPrinting);
|
|
|
|
|
}
|