1*0a6a1f1dSLionel Sambuc /* $NetBSD: asprintf.c,v 1.1.1.4 2015/01/02 20:34:27 christos Exp $ */
2ef01931fSBen Gras
3ef01931fSBen Gras /*
4ef01931fSBen Gras * Copyright (c) Ian F. Darwin 1986-1995.
5ef01931fSBen Gras * Software written by Ian F. Darwin and others;
6ef01931fSBen Gras * maintained 1995-present by Christos Zoulas and others.
7ef01931fSBen Gras *
8ef01931fSBen Gras * Redistribution and use in source and binary forms, with or without
9ef01931fSBen Gras * modification, are permitted provided that the following conditions
10ef01931fSBen Gras * are met:
11ef01931fSBen Gras * 1. Redistributions of source code must retain the above copyright
12ef01931fSBen Gras * notice immediately at the beginning of the file, without modification,
13ef01931fSBen Gras * this list of conditions, and the following disclaimer.
14ef01931fSBen Gras * 2. Redistributions in binary form must reproduce the above copyright
15ef01931fSBen Gras * notice, this list of conditions and the following disclaimer in the
16ef01931fSBen Gras * documentation and/or other materials provided with the distribution.
17ef01931fSBen Gras *
18ef01931fSBen Gras * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19ef01931fSBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20ef01931fSBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ef01931fSBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22ef01931fSBen Gras * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23ef01931fSBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24ef01931fSBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25ef01931fSBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26ef01931fSBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27ef01931fSBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28ef01931fSBen Gras * SUCH DAMAGE.
29ef01931fSBen Gras */
30ef01931fSBen Gras
31ef01931fSBen Gras #include "file.h"
32ef01931fSBen Gras
33ef01931fSBen Gras #ifndef lint
34ef01931fSBen Gras #if 0
35835f6802SDirk Vogt FILE_RCSID("@(#)$File: asprintf.c,v 1.4 2010/07/21 16:47:17 christos Exp $")
36ef01931fSBen Gras #else
37*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: asprintf.c,v 1.1.1.4 2015/01/02 20:34:27 christos Exp $");
38ef01931fSBen Gras #endif
39ef01931fSBen Gras #endif
40ef01931fSBen Gras
asprintf(char ** ptr,const char * fmt,...)41ef01931fSBen Gras int asprintf(char **ptr, const char *fmt, ...)
42ef01931fSBen Gras {
43ef01931fSBen Gras va_list vargs;
44ef01931fSBen Gras int retval;
45ef01931fSBen Gras
46ef01931fSBen Gras va_start(vargs, fmt);
47ef01931fSBen Gras retval = vasprintf(ptr, fmt, vargs);
48ef01931fSBen Gras va_end(vargs);
49ef01931fSBen Gras
50ef01931fSBen Gras return retval;
51ef01931fSBen Gras }
52