xref: /openbsd-src/lib/libc/stdio/dprintf.c (revision 9b9d2a55a62c8e82206c25f94fcc7f4e2765250e)
1*9b9d2a55Sguenther /*	$OpenBSD: dprintf.c,v 1.2 2015/08/31 02:53:57 guenther Exp $	*/
2f2c0f4acSbrad /*	$FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.2 2012/11/17 01:49:39 svnexp Exp $	*/
3f2c0f4acSbrad 
4f2c0f4acSbrad /*-
5f2c0f4acSbrad  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
6f2c0f4acSbrad  * All rights reserved.
7f2c0f4acSbrad  *
8f2c0f4acSbrad  * Copyright (c) 2011 The FreeBSD Foundation
9f2c0f4acSbrad  * All rights reserved.
10f2c0f4acSbrad  * Portions of this software were developed by David Chisnall
11f2c0f4acSbrad  * under sponsorship from the FreeBSD Foundation.
12f2c0f4acSbrad  *
13f2c0f4acSbrad  * Redistribution and use in source and binary forms, with or without
14f2c0f4acSbrad  * modification, are permitted provided that the following conditions
15f2c0f4acSbrad  * are met:
16f2c0f4acSbrad  * 1. Redistributions of source code must retain the above copyright
17f2c0f4acSbrad  *    notice, this list of conditions and the following disclaimer.
18f2c0f4acSbrad  * 2. Redistributions in binary form must reproduce the above copyright
19f2c0f4acSbrad  *    notice, this list of conditions and the following disclaimer in the
20f2c0f4acSbrad  *    documentation and/or other materials provided with the distribution.
21f2c0f4acSbrad  *
22f2c0f4acSbrad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23f2c0f4acSbrad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24f2c0f4acSbrad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25f2c0f4acSbrad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26f2c0f4acSbrad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27f2c0f4acSbrad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28f2c0f4acSbrad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29f2c0f4acSbrad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30f2c0f4acSbrad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31f2c0f4acSbrad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32f2c0f4acSbrad  * SUCH DAMAGE.
33f2c0f4acSbrad  */
34f2c0f4acSbrad 
35f2c0f4acSbrad #include <stdio.h>
36f2c0f4acSbrad #include <stdarg.h>
37f2c0f4acSbrad 
38f2c0f4acSbrad int
dprintf(int fd,const char * __restrict fmt,...)39f2c0f4acSbrad dprintf(int fd, const char * __restrict fmt, ...)
40f2c0f4acSbrad {
41f2c0f4acSbrad 	va_list ap;
42f2c0f4acSbrad 	int ret;
43f2c0f4acSbrad 
44f2c0f4acSbrad 	va_start(ap, fmt);
45f2c0f4acSbrad 	ret = vdprintf(fd, fmt, ap);
46f2c0f4acSbrad 	va_end(ap);
47f2c0f4acSbrad 	return ret;
48f2c0f4acSbrad }
49*9b9d2a55Sguenther DEF_WEAK(dprintf);
50