aboutsummaryrefslogtreecommitdiff
path: root/lib/errors/vwarn.c
blob: 342c391ce1ba4e73aee65df4a0f23ab3bcce1cae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

#include "errors.h"

void
vwarn(const char *fmt, va_list ap)
{
	int save = errno;
	fprintf(stderr, "%s: ", mlib_progname());
	vfprintf(stderr, fmt, ap);
	if (fmt[strlen(fmt) - 1] == ':')
		fprintf(stderr, " %s", strerror(save));
	fputc('\n', stderr);
}