1284194Sdelphij/* 2284194Sdelphij * Copyright (c) Ian F. Darwin 1986-1995. 3284194Sdelphij * Software written by Ian F. Darwin and others; 4284194Sdelphij * maintained 1995-present by Christos Zoulas and others. 5284194Sdelphij * 6284194Sdelphij * Redistribution and use in source and binary forms, with or without 7284194Sdelphij * modification, are permitted provided that the following conditions 8284194Sdelphij * are met: 9284194Sdelphij * 1. Redistributions of source code must retain the above copyright 10284194Sdelphij * notice immediately at the beginning of the file, without modification, 11284194Sdelphij * this list of conditions, and the following disclaimer. 12284194Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 13284194Sdelphij * notice, this list of conditions and the following disclaimer in the 14284194Sdelphij * documentation and/or other materials provided with the distribution. 15284194Sdelphij * 16284194Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17284194Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18284194Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19284194Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20284194Sdelphij * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21284194Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22284194Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23284194Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24284194Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25284194Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26284194Sdelphij * SUCH DAMAGE. 27284194Sdelphij */ 28284194Sdelphij 29284194Sdelphij#include "file.h" 30284194Sdelphij 31284194Sdelphij#ifndef lint 32284194SdelphijFILE_RCSID("@(#)$File: asprintf.c,v 1.4 2010/07/21 16:47:17 christos Exp $") 33284194Sdelphij#endif 34284194Sdelphij 35284194Sdelphijint asprintf(char **ptr, const char *fmt, ...) 36284194Sdelphij{ 37284194Sdelphij va_list vargs; 38284194Sdelphij int retval; 39284194Sdelphij 40284194Sdelphij va_start(vargs, fmt); 41284194Sdelphij retval = vasprintf(ptr, fmt, vargs); 42284194Sdelphij va_end(vargs); 43284194Sdelphij 44284194Sdelphij return retval; 45284194Sdelphij} 46