asprintf.c revision 191736
192512Sphk/* 292512Sphk * Copyright (c) Ian F. Darwin 1986-1995. 392512Sphk * Software written by Ian F. Darwin and others; 492512Sphk * maintained 1995-present by Christos Zoulas and others. 592512Sphk * 692512Sphk * Redistribution and use in source and binary forms, with or without 792512Sphk * modification, are permitted provided that the following conditions 892512Sphk * are met: 992512Sphk * 1. Redistributions of source code must retain the above copyright 1092512Sphk * notice immediately at the beginning of the file, without modification, 1192512Sphk * this list of conditions, and the following disclaimer. 1292512Sphk * 2. Redistributions in binary form must reproduce the above copyright 1392512Sphk * notice, this list of conditions and the following disclaimer in the 1492512Sphk * documentation and/or other materials provided with the distribution. 1592512Sphk * 1692512Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1792512Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1892512Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1992512Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 2092512Sphk * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2192512Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2292512Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2392512Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2492512Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2592512Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2692512Sphk * SUCH DAMAGE. 2792512Sphk */ 2892512Sphk 2992512Sphk#include "file.h" 3092512Sphk 3192512Sphk#ifndef lint 3292512SphkFILE_RCSID("@(#)$File: asprintf.c,v 1.3 2009/02/03 20:27:51 christos Exp $") 3392512Sphk#endif 3492512Sphk 3592512Sphkint vasprintf(char **ptr, const char *format_string, va_list vargs); 3692512Sphk 3792512Sphkint asprintf(char **ptr, const char *fmt, ...) 3892512Sphk{ 3992512Sphk va_list vargs; 4092512Sphk int retval; 4192512Sphk 4292512Sphk va_start(vargs, fmt); 4392512Sphk retval = vasprintf(ptr, fmt, vargs); 4492512Sphk va_end(vargs); 4592512Sphk 4692512Sphk return retval; 4792512Sphk} 4892512Sphk