asprintf.c revision 191739
1102697Stjr/* 2127944Stjr * Copyright (c) Ian F. Darwin 1986-1995. 3118591Stjr * Software written by Ian F. Darwin and others; 4102697Stjr * maintained 1995-present by Christos Zoulas and others. 5227753Stheraven * 6227753Stheraven * Redistribution and use in source and binary forms, with or without 7227753Stheraven * modification, are permitted provided that the following conditions 8227753Stheraven * are met: 9227753Stheraven * 1. Redistributions of source code must retain the above copyright 10102697Stjr * notice immediately at the beginning of the file, without modification, 11102697Stjr * this list of conditions, and the following disclaimer. 12102697Stjr * 2. Redistributions in binary form must reproduce the above copyright 13102697Stjr * notice, this list of conditions and the following disclaimer in the 14102697Stjr * documentation and/or other materials provided with the distribution. 15102697Stjr * 16102697Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17102697Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18102697Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19118591Stjr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20102697Stjr * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21102697Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22118591Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23102697Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24102697Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25102697Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26102697Stjr * SUCH DAMAGE. 27102697Stjr */ 28102697Stjr 29102697Stjr#include "file.h" 30102697Stjr 31102697Stjr#ifndef lint 32102697StjrFILE_RCSID("@(#)$File: asprintf.c,v 1.3 2009/02/03 20:27:51 christos Exp $") 33102697Stjr#endif 34102697Stjr 35102697Stjrint vasprintf(char **ptr, const char *format_string, va_list vargs); 36118591Stjr 37129154Stjrint asprintf(char **ptr, const char *fmt, ...) 38102697Stjr{ 39102697Stjr va_list vargs; 40227753Stheraven int retval; 41102697Stjr 42127944Stjr va_start(vargs, fmt); 43118591Stjr retval = vasprintf(ptr, fmt, vargs); 44227753Stheraven va_end(vargs); 45102697Stjr 46127944Stjr return retval; 47106032Stjr} 48227753Stheraven