xref: /freebsd/lib/libc/stdio/dprintf.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
1ad760e6fSDavid Schultz /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d915a14eSPedro F. Giffuni  *
4ad760e6fSDavid Schultz  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
5ad760e6fSDavid Schultz  * All rights reserved.
6ad760e6fSDavid Schultz  *
7ad760e6fSDavid Schultz  * Redistribution and use in source and binary forms, with or without
8ad760e6fSDavid Schultz  * modification, are permitted provided that the following conditions
9ad760e6fSDavid Schultz  * are met:
10ad760e6fSDavid Schultz  * 1. Redistributions of source code must retain the above copyright
11ad760e6fSDavid Schultz  *    notice, this list of conditions and the following disclaimer.
12ad760e6fSDavid Schultz  * 2. Redistributions in binary form must reproduce the above copyright
13ad760e6fSDavid Schultz  *    notice, this list of conditions and the following disclaimer in the
14ad760e6fSDavid Schultz  *    documentation and/or other materials provided with the distribution.
15ad760e6fSDavid Schultz  *
16ad760e6fSDavid Schultz  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17ad760e6fSDavid Schultz  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18ad760e6fSDavid Schultz  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ad760e6fSDavid Schultz  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20ad760e6fSDavid Schultz  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21ad760e6fSDavid Schultz  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22ad760e6fSDavid Schultz  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23ad760e6fSDavid Schultz  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24ad760e6fSDavid Schultz  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25ad760e6fSDavid Schultz  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26ad760e6fSDavid Schultz  * SUCH DAMAGE.
27ad760e6fSDavid Schultz  */
28ad760e6fSDavid Schultz 
29ad760e6fSDavid Schultz #include "namespace.h"
30ad760e6fSDavid Schultz #include <stdarg.h>
31ad760e6fSDavid Schultz #include <stdio.h>
32ad760e6fSDavid Schultz #include "un-namespace.h"
33ad760e6fSDavid Schultz 
34ad760e6fSDavid Schultz int
dprintf(int fd,const char * __restrict fmt,...)35ad760e6fSDavid Schultz dprintf(int fd, const char * __restrict fmt, ...)
36ad760e6fSDavid Schultz {
37ad760e6fSDavid Schultz 	va_list ap;
38ad760e6fSDavid Schultz 	int ret;
39ad760e6fSDavid Schultz 
40ad760e6fSDavid Schultz 	va_start(ap, fmt);
41ad760e6fSDavid Schultz 	ret = vdprintf(fd, fmt, ap);
42ad760e6fSDavid Schultz 	va_end(ap);
43ad760e6fSDavid Schultz 	return (ret);
44ad760e6fSDavid Schultz }
45