xref: /openbsd-src/lib/libc/gen/vwarnc.c (revision e422429247bd689ad82a15ebdacdfc785b980b1d)
1*e4224292Sguenther /*	$OpenBSD: vwarnc.c,v 1.3 2016/03/13 18:34:20 guenther Exp $ */
2d01ec059Sguenther /*-
3d01ec059Sguenther  * Copyright (c) 1993
4d01ec059Sguenther  *	The Regents of the University of California.  All rights reserved.
5d01ec059Sguenther  *
6d01ec059Sguenther  * Redistribution and use in source and binary forms, with or without
7d01ec059Sguenther  * modification, are permitted provided that the following conditions
8d01ec059Sguenther  * are met:
9d01ec059Sguenther  * 1. Redistributions of source code must retain the above copyright
10d01ec059Sguenther  *    notice, this list of conditions and the following disclaimer.
11d01ec059Sguenther  * 2. Redistributions in binary form must reproduce the above copyright
12d01ec059Sguenther  *    notice, this list of conditions and the following disclaimer in the
13d01ec059Sguenther  *    documentation and/or other materials provided with the distribution.
14d01ec059Sguenther  * 3. Neither the name of the University nor the names of its contributors
15d01ec059Sguenther  *    may be used to endorse or promote products derived from this software
16d01ec059Sguenther  *    without specific prior written permission.
17d01ec059Sguenther  *
18d01ec059Sguenther  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19d01ec059Sguenther  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20d01ec059Sguenther  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21d01ec059Sguenther  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22d01ec059Sguenther  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23d01ec059Sguenther  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24d01ec059Sguenther  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25d01ec059Sguenther  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26d01ec059Sguenther  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27d01ec059Sguenther  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28d01ec059Sguenther  * SUCH DAMAGE.
29d01ec059Sguenther  */
30d01ec059Sguenther 
31d01ec059Sguenther #include <err.h>
32d01ec059Sguenther #include <stdio.h>
33*e4224292Sguenther #include <stdlib.h>
34d01ec059Sguenther #include <string.h>
35d01ec059Sguenther #include <stdarg.h>
36d01ec059Sguenther 
37d01ec059Sguenther void
vwarnc(int code,const char * fmt,va_list ap)389b9d2a55Sguenther vwarnc(int code, const char *fmt, va_list ap)
39d01ec059Sguenther {
40d01ec059Sguenther 	(void)fprintf(stderr, "%s: ", __progname);
41d01ec059Sguenther 	if (fmt != NULL) {
42d01ec059Sguenther 		(void)vfprintf(stderr, fmt, ap);
43d01ec059Sguenther 		(void)fprintf(stderr, ": ");
44d01ec059Sguenther 	}
45d01ec059Sguenther 	(void)fprintf(stderr, "%s\n", strerror(code));
46d01ec059Sguenther }
479b9d2a55Sguenther DEF_WEAK(vwarnc);
48