1186690Sobrien/* 2186690Sobrien * Copyright (c) Ian F. Darwin 1986-1995. 3186690Sobrien * Software written by Ian F. Darwin and others; 4186690Sobrien * maintained 1995-present by Christos Zoulas and others. 5354939Sdelphij * 6186690Sobrien * Redistribution and use in source and binary forms, with or without 7186690Sobrien * modification, are permitted provided that the following conditions 8186690Sobrien * are met: 9186690Sobrien * 1. Redistributions of source code must retain the above copyright 10186690Sobrien * notice immediately at the beginning of the file, without modification, 11186690Sobrien * this list of conditions, and the following disclaimer. 12186690Sobrien * 2. Redistributions in binary form must reproduce the above copyright 13186690Sobrien * notice, this list of conditions and the following disclaimer in the 14186690Sobrien * documentation and/or other materials provided with the distribution. 15354939Sdelphij * 16186690Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17186690Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18186690Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19186690Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20186690Sobrien * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21186690Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22186690Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23186690Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24186690Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25186690Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26186690Sobrien * SUCH DAMAGE. 27186690Sobrien */ 28186690Sobrien 29191736Sobrien#include "file.h" 30186690Sobrien 31191736Sobrien#ifndef lint 32354939SdelphijFILE_RCSID("@(#)$File: asprintf.c,v 1.5 2018/09/09 20:33:28 christos Exp $") 33191736Sobrien#endif 34191736Sobrien 35186690Sobrienint asprintf(char **ptr, const char *fmt, ...) 36186690Sobrien{ 37186690Sobrien va_list vargs; 38186690Sobrien int retval; 39186690Sobrien 40186690Sobrien va_start(vargs, fmt); 41186690Sobrien retval = vasprintf(ptr, fmt, vargs); 42186690Sobrien va_end(vargs); 43186690Sobrien 44186690Sobrien return retval; 45186690Sobrien} 46