summaryrefslogblamecommitdiff
path: root/util.h
blob: fbaf60c7863c58c4d059e9acbe0e93e0f80ebfbe (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                     
#include <stdio.h>
#include <stdarg.h>

enum plog { PLOG_INFO, PLOG_WARN, PLOG_ERR };
static const char *msg[] = { "info", "warn", "eror"};

void plog(enum plog type, const char *fmt, ...)
{
	va_list args;

	va_start(args, fmt);
	fprintf(stderr, "%s: ",msg[type]);
	vfprintf(stderr, fmt, args);
	putc('\n', stderr);
	va_end(args);
}