You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
656 B
43 lines
656 B
6 years ago
|
|
||
|
|
||
|
#include "ugl.h"
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int ugl_current_input_line;
|
||
|
int ugl_is_suppress_log = 0;
|
||
|
|
||
|
|
||
|
void ugl_err(const char *fmt, ...)
|
||
|
{
|
||
|
va_list va;
|
||
|
va_start(va, fmt);
|
||
|
vprintf(fmt, va);
|
||
|
printf("\n");
|
||
|
va_end(va);
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
void ugl_plog(const char *fmt, ...)
|
||
|
{
|
||
|
va_list va;
|
||
|
if ( ugl_is_suppress_log != 0 )
|
||
|
return;
|
||
|
va_start(va, fmt);
|
||
|
printf("%d: ", ugl_current_input_line);
|
||
|
vprintf(fmt, va);
|
||
|
printf("\n");
|
||
|
va_end(va);
|
||
|
}
|
||
|
|
||
|
/* generic log */
|
||
|
void ugl_glog(const char *fmt, ...)
|
||
|
{
|
||
|
va_list va;
|
||
|
if ( ugl_is_suppress_log != 0 )
|
||
|
return;
|
||
|
va_start(va, fmt);
|
||
|
vprintf(fmt, va);
|
||
|
printf("\n");
|
||
|
va_end(va);
|
||
|
}
|