aboutsummaryrefslogtreecommitdiff
path: root/doc/grecs_asprintf.3
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-04 20:10:36 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-04 21:41:39 +0300
commita60eb4b18345626a84e23784d77ca231812e1dff (patch)
tree80192afeadd44b073958c2762491cc7dfea778a1 /doc/grecs_asprintf.3
parentb65bfa7564f564f85d3c595c6c1030af2acf5056 (diff)
downloadgrecs-a60eb4b18345626a84e23784d77ca231812e1dff.tar.gz
grecs-a60eb4b18345626a84e23784d77ca231812e1dff.tar.bz2
Improve docs. Add an option to create installable distribution.
Diffstat (limited to 'doc/grecs_asprintf.3')
-rw-r--r--doc/grecs_asprintf.390
1 files changed, 90 insertions, 0 deletions
diff --git a/doc/grecs_asprintf.3 b/doc/grecs_asprintf.3
new file mode 100644
index 0000000..73be7f0
--- /dev/null
+++ b/doc/grecs_asprintf.3
@@ -0,0 +1,90 @@
1.\" This file is part of grecs -*- nroff -*-
2.\" Copyright (C) 2007, 2009-2011 Sergey Poznyakoff
3.\"
4.\" Grecs is free software; you can redistribute it and/or modify
5.\" it under the terms of the GNU General Public License as published by
6.\" the Free Software Foundation; either version 3, or (at your option)
7.\" any later version.
8.\"
9.\" Grecs is distributed in the hope that it will be useful,
10.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.\" GNU General Public License for more details.
13.\"
14.\" You should have received a copy of the GNU General Public License
15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
16.\" This file is part of SLB.
17.\" Copyright (C) 2011 Sergey Poznyakoff
18.\"
19.TH GRECS_ASPRINTF 3 "May 4, 2011" "GRECS" "Grecs User Reference"
20.SH NAME
21grecs_asprintf, grecs_vasprintf \- print to allocated string
22.SH SYNOPSIS
23.nf
24.B #include <grecs.h>
25.sp
26.BI "int grecs_vasprintf(char " "**pbuf" ", size_t " "*psize" \
27 ", const char " "*format" ", "
28.ti +17
29.BI "va_list " "ap" );
30.br
31.BI "int grecs_asprintf(char " "**pbuf" ", size_t " "*psize" \
32 ", const char *" "format" ", ...);"
33.SH DESCRIPTION
34The functions
35.BI grecs_asprintf ()
36and
37.BI grecs_vasprintf ()
38are analogs of
39.BR sprintf (3)
40and
41.BR vsprintf (3),
42except that they operate on dynamically allocated buffers.
43.PP
44If, on entry to the function, \fB*pbuf\fR is NULL and \fB*psize\fR is
450, both functions will allocate a buffer large enough to hold the
46formatted message and will fill it with the formatted text.
47.PP
48If \fB*pbuf\fR is not NULL, \fBpsize\fR must point to its actual size.
49If that size is not large enough to accomodate the formatted message,
50the buffer will be reallocated accordingly, otherwise it will remain
51unchanged.
52.PP
53In both cases, if the buffer has been reallocated, on return
54\fBpbuf\fR will contain its new address and \fBpsize\fR its new size.
55.PP
56For initial allocation,
57.BR grecs_malloc (3)
58is used. To reallocate memory, both functions use
59.BR grecs_realloc (3).
60.SH RETURN VALUE
61None. If memory allocation fails, a diagnostics is output and the
62program is terminated.
63.SH "SEE ALSO"
64.BR grecs_malloc (3),
65.BR grecs_realloc (3).
66.SH AUTHORS
67Sergey Poznyakoff
68.SH "BUG REPORTS"
69Report bugs to <gray+grecs@gnu.org.ua>.
70.SH COLOPHON
71The \fBGrecs\fR library is constantly changing, so this manual page
72may be incorrect or out-of-date. For the latest copy of \fBGrecs\fR
73documentation, visit <http://www.gnu.org.ua/software/grecs>.
74.SH COPYRIGHT
75Copyright \(co 2011 Sergey Poznyakoff
76.br
77.na
78License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
79.br
80.ad
81This is free software: you are free to change and redistribute it.
82There is NO WARRANTY, to the extent permitted by law.
83.\" Local variables:
84.\" eval: (add-hook 'write-file-hooks 'time-stamp)
85.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \""
86.\" time-stamp-format: "%:B %:d, %:y"
87.\" time-stamp-end: "\""
88.\" time-stamp-line-limit: 20
89.\" end:
90

Return to:

Send suggestions and report system problems to the System administrator.