XD/helpers.c

28 lines
408 B
C

#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "helpers.h"
#ifdef EXPLAIN
int explain = 0;
#endif
#if defined(ERR) || defined(EXPLAIN)
void
l(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
}
#endif