11.2Sjoerg/* $NetBSD: dprintf.c,v 1.2 2013/04/19 15:22:25 joerg Exp $ */ 21.1Schristos 31.1Schristos/*- 41.1Schristos * Copyright (c) 1990, 1993 51.1Schristos * The Regents of the University of California. All rights reserved. 61.1Schristos * 71.1Schristos * This code is derived from software contributed to Berkeley by 81.1Schristos * Chris Torek. 91.1Schristos * 101.1Schristos * Redistribution and use in source and binary forms, with or without 111.1Schristos * modification, are permitted provided that the following conditions 121.1Schristos * are met: 131.1Schristos * 1. Redistributions of source code must retain the above copyright 141.1Schristos * notice, this list of conditions and the following disclaimer. 151.1Schristos * 2. Redistributions in binary form must reproduce the above copyright 161.1Schristos * notice, this list of conditions and the following disclaimer in the 171.1Schristos * documentation and/or other materials provided with the distribution. 181.1Schristos * 3. Neither the name of the University nor the names of its contributors 191.1Schristos * may be used to endorse or promote products derived from this software 201.1Schristos * without specific prior written permission. 211.1Schristos * 221.1Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Schristos * SUCH DAMAGE. 331.1Schristos */ 341.1Schristos 351.1Schristos#include <sys/cdefs.h> 361.1Schristos#if defined(LIBC_SCCS) && !defined(lint) 371.2Sjoerg__RCSID("$NetBSD: dprintf.c,v 1.2 2013/04/19 15:22:25 joerg Exp $"); 381.1Schristos#endif /* LIBC_SCCS and not lint */ 391.1Schristos 401.1Schristos#include "namespace.h" 411.1Schristos#include <sys/types.h> 421.1Schristos 431.1Schristos#include <stdio.h> 441.1Schristos#include <stdarg.h> 451.1Schristos 461.1Schristos#include "reentrant.h" 471.1Schristos#include "local.h" 481.1Schristos 491.2Sjoerg__weak_alias(dprintf_l, _dprintf_l) 501.2Sjoerg 511.1Schristosint 521.1Schristosdprintf(int fd, const char * __restrict fmt, ...) 531.1Schristos{ 541.1Schristos va_list ap; 551.1Schristos int ret; 561.1Schristos 571.1Schristos va_start(ap, fmt); 581.1Schristos ret = vdprintf(fd, fmt, ap); 591.1Schristos va_end(ap); 601.1Schristos return ret; 611.1Schristos} 621.2Sjoerg 631.2Sjoergint 641.2Sjoergdprintf_l(int fd, locale_t loc, const char * __restrict fmt, ...) 651.2Sjoerg{ 661.2Sjoerg va_list ap; 671.2Sjoerg int ret; 681.2Sjoerg 691.2Sjoerg va_start(ap, fmt); 701.2Sjoerg ret = vdprintf_l(fd, loc, fmt, ap); 711.2Sjoerg va_end(ap); 721.2Sjoerg return ret; 731.2Sjoerg} 74