]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/asprintf.3
malloc.3: Add reference to glibc MallocInternals wiki
[thirdparty/man-pages.git] / man3 / asprintf.3
index e61375975ef99ab2529c12dbda72da2a197a1996..d2aaf3ccc38ae4f35169f3c25102017788a43776 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Text fragments inspired by Martin Schulze <joey@infodrom.org>.
 .\"
-.TH ASPRINTF 3 2001-12-18 "GNU" "Linux Programmer's Manual"
+.TH ASPRINTF 3 2017-09-15 "GNU" "Linux Programmer's Manual"
 .SH NAME
 asprintf, vasprintf \- print to allocated string
 .SH SYNOPSIS
-.B #define _GNU_SOURCE
+.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
 .br
 .B #include <stdio.h>
-.sp
+.PP
 .BI "int asprintf(char **" strp ", const char *" fmt ", ...);"
-.sp
+.PP
 .BI "int vasprintf(char **" strp ", const char *" fmt ", va_list " ap );
 .SH DESCRIPTION
 The functions
@@ -43,27 +45,40 @@ are analogs of
 and
 .BR vsprintf (3),
 except that they allocate a string large enough to hold the output
-including the terminating null byte,
-and return a pointer to it via the first parameter.
+including the terminating null byte (\(aq\\0\(aq),
+and return a pointer to it via the first argument.
 This pointer should be passed to
 .BR free (3)
 to release the allocated storage when it is no longer needed.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 When successful, these functions return the number of bytes printed,
 just like
 .BR sprintf (3).
 If memory allocation wasn't possible, or some other error occurs,
 these functions will return \-1, and the contents of
 .I strp
-is undefined.
+are undefined.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbw23 lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR asprintf (),
+.BR vasprintf ()
+T}     Thread safety   MT-Safe locale
+.TE
+.sp 1
 .SH CONFORMING TO
 These functions are GNU extensions, not in C or POSIX.
 They are also available under *BSD.
 The FreeBSD implementation sets
 .I strp
 to NULL on error.
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR free (3),
 .BR malloc (3),
-.BR printf (3),
-.BR feature_test_macros (7)
+.BR printf (3)