xref: /netbsd-src/external/gpl2/gettext/dist/gettext-runtime/intl/vasnwprintf.h (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos /* vswprintf with automatic memory allocation.
2*946379e7Schristos    Copyright (C) 2002-2003 Free Software Foundation, Inc.
3*946379e7Schristos 
4*946379e7Schristos    This program is free software; you can redistribute it and/or modify it
5*946379e7Schristos    under the terms of the GNU Library General Public License as published
6*946379e7Schristos    by the Free Software Foundation; either version 2, or (at your option)
7*946379e7Schristos    any later version.
8*946379e7Schristos 
9*946379e7Schristos    This program is distributed in the hope that it will be useful,
10*946379e7Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*946379e7Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*946379e7Schristos    Library General Public License for more details.
13*946379e7Schristos 
14*946379e7Schristos    You should have received a copy of the GNU Library General Public
15*946379e7Schristos    License along with this program; if not, write to the Free Software
16*946379e7Schristos    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17*946379e7Schristos    USA.  */
18*946379e7Schristos 
19*946379e7Schristos #ifndef _VASNWPRINTF_H
20*946379e7Schristos #define _VASNWPRINTF_H
21*946379e7Schristos 
22*946379e7Schristos /* Get va_list.  */
23*946379e7Schristos #include <stdarg.h>
24*946379e7Schristos 
25*946379e7Schristos /* Get wchar_t, size_t.  */
26*946379e7Schristos #include <stddef.h>
27*946379e7Schristos 
28*946379e7Schristos #ifdef	__cplusplus
29*946379e7Schristos extern "C" {
30*946379e7Schristos #endif
31*946379e7Schristos 
32*946379e7Schristos /* Write formatted output to a string dynamically allocated with malloc().
33*946379e7Schristos    You can pass a preallocated buffer for the result in RESULTBUF and its
34*946379e7Schristos    size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
35*946379e7Schristos    If successful, return the address of the string (this may be = RESULTBUF
36*946379e7Schristos    if no dynamic memory allocation was necessary) and set *LENGTHP to the
37*946379e7Schristos    number of resulting bytes, excluding the trailing NUL.  Upon error, set
38*946379e7Schristos    errno and return NULL.  */
39*946379e7Schristos extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...);
40*946379e7Schristos extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args);
41*946379e7Schristos 
42*946379e7Schristos #ifdef	__cplusplus
43*946379e7Schristos }
44*946379e7Schristos #endif
45*946379e7Schristos 
46*946379e7Schristos #endif /* _VASNWPRINTF_H */
47