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