1184610Salfred/*	$OpenBSD: vwarnc.c,v 1.3 2016/03/13 18:34:20 guenther Exp $ */
2184610Salfred/*-
3184610Salfred * Copyright (c) 1993
4184610Salfred *	The Regents of the University of California.  All rights reserved.
5184610Salfred *
6184610Salfred * Redistribution and use in source and binary forms, with or without
7184610Salfred * modification, are permitted provided that the following conditions
8184610Salfred * are met:
9184610Salfred * 1. Redistributions of source code must retain the above copyright
10184610Salfred *    notice, this list of conditions and the following disclaimer.
11184610Salfred * 2. Redistributions in binary form must reproduce the above copyright
12184610Salfred *    notice, this list of conditions and the following disclaimer in the
13184610Salfred *    documentation and/or other materials provided with the distribution.
14184610Salfred * 3. Neither the name of the University nor the names of its contributors
15184610Salfred *    may be used to endorse or promote products derived from this software
16184610Salfred *    without specific prior written permission.
17184610Salfred *
18184610Salfred * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21184610Salfred * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22184610Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23184610Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24184610Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25184610Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26184610Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27184610Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28184610Salfred * SUCH DAMAGE.
29184610Salfred */
30184610Salfred
31184610Salfred#include <err.h>
32184610Salfred#include <stdio.h>
33184610Salfred#include <stdlib.h>
34184610Salfred#include <string.h>
35184610Salfred#include <stdarg.h>
36184610Salfred
37184610Salfredvoid
38184610Salfredvwarnc(int code, const char *fmt, va_list ap)
39184610Salfred{
40184610Salfred	(void)fprintf(stderr, "%s: ", __progname);
41184610Salfred	if (fmt != NULL) {
42184610Salfred		(void)vfprintf(stderr, fmt, ap);
43184610Salfred		(void)fprintf(stderr, ": ");
44184610Salfred	}
45184610Salfred	(void)fprintf(stderr, "%s\n", strerror(code));
46184610Salfred}
47184610SalfredDEF_WEAK(vwarnc);
48184610Salfred