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