xref: /dragonfly/contrib/cvs-1.12/lib/asnprintf.c (revision 86d7f5d3)
1*86d7f5d3SJohn Marino /* Formatted output to strings.
2*86d7f5d3SJohn Marino    Copyright (C) 1999, 2002 Free Software Foundation, Inc.
3*86d7f5d3SJohn Marino 
4*86d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
5*86d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
6*86d7f5d3SJohn Marino    the Free Software Foundation; either version 2, or (at your option)
7*86d7f5d3SJohn Marino    any later version.
8*86d7f5d3SJohn Marino 
9*86d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
10*86d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*86d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*86d7f5d3SJohn Marino    GNU General Public License for more details.
13*86d7f5d3SJohn Marino 
14*86d7f5d3SJohn Marino    You should have received a copy of the GNU General Public License along
15*86d7f5d3SJohn Marino    with this program; if not, write to the Free Software Foundation,
16*86d7f5d3SJohn Marino    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17*86d7f5d3SJohn Marino 
18*86d7f5d3SJohn Marino #ifdef HAVE_CONFIG_H
19*86d7f5d3SJohn Marino # include <config.h>
20*86d7f5d3SJohn Marino #endif
21*86d7f5d3SJohn Marino 
22*86d7f5d3SJohn Marino /* Specification.  */
23*86d7f5d3SJohn Marino #include "vasnprintf.h"
24*86d7f5d3SJohn Marino 
25*86d7f5d3SJohn Marino #include <stdarg.h>
26*86d7f5d3SJohn Marino 
27*86d7f5d3SJohn Marino char *
asnprintf(char * resultbuf,size_t * lengthp,const char * format,...)28*86d7f5d3SJohn Marino asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
29*86d7f5d3SJohn Marino {
30*86d7f5d3SJohn Marino   va_list args;
31*86d7f5d3SJohn Marino   char *result;
32*86d7f5d3SJohn Marino 
33*86d7f5d3SJohn Marino   va_start (args, format);
34*86d7f5d3SJohn Marino   result = vasnprintf (resultbuf, lengthp, format, args);
35*86d7f5d3SJohn Marino   va_end (args);
36*86d7f5d3SJohn Marino   return result;
37*86d7f5d3SJohn Marino }
38