1124483Sdes/*	$NetBSD: asprintf.c,v 1.1.1.6 2023/08/18 18:36:49 christos Exp $	*/
2124483Sdes
3124483Sdes/*
4124483Sdes * Copyright (c) Ian F. Darwin 1986-1995.
5124483Sdes * Software written by Ian F. Darwin and others;
6124483Sdes * maintained 1995-present by Christos Zoulas and others.
7124483Sdes *
8124483Sdes * Redistribution and use in source and binary forms, with or without
9124483Sdes * modification, are permitted provided that the following conditions
10124483Sdes * are met:
11124483Sdes * 1. Redistributions of source code must retain the above copyright
12124483Sdes *    notice immediately at the beginning of the file, without modification,
13124483Sdes *    this list of conditions, and the following disclaimer.
14124483Sdes * 2. Redistributions in binary form must reproduce the above copyright
15124483Sdes *    notice, this list of conditions and the following disclaimer in the
16124483Sdes *    documentation and/or other materials provided with the distribution.
17124483Sdes *
18124483Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19124483Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20124483Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21124483Sdes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22124483Sdes * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23124483Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24124483Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25124483Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26124483Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27124483Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28124483Sdes * SUCH DAMAGE.
29124483Sdes */
30124483Sdes
31124483Sdes#include "file.h"
32124483Sdes
33124483Sdes#ifndef lint
34124483Sdes#if 0
35124483SdesFILE_RCSID("@(#)$File: asprintf.c,v 1.7 2022/09/24 20:30:13 christos Exp $")
36124483Sdes#else
37124483Sdes__RCSID("$NetBSD: asprintf.c,v 1.1.1.6 2023/08/18 18:36:49 christos Exp $");
38124483Sdes#endif
39124483Sdes#endif
40124483Sdes
41124483Sdesint asprintf(char **ptr, const char *fmt, ...)
42124483Sdes{
43124483Sdes  va_list vargs;
44124483Sdes  int retval;
45124483Sdes
46124483Sdes  va_start(vargs, fmt);
47124483Sdes  retval = vasprintf(ptr, fmt, vargs);
48124483Sdes  va_end(vargs);
49124483Sdes
50124483Sdes  return retval;
51124483Sdes}
52124483Sdes