xref: /dragonfly/contrib/diffutils/lib/asnprintf.c (revision 6ea1f93e)
14536c563SJohn Marino /* Formatted output to strings.
2*6ea1f93eSDaniel Fojt    Copyright (C) 1999, 2002, 2006, 2009-2018 Free Software Foundation, Inc.
34536c563SJohn Marino 
44536c563SJohn Marino    This program is free software; you can redistribute it and/or modify
54536c563SJohn Marino    it under the terms of the GNU General Public License as published by
64536c563SJohn Marino    the Free Software Foundation; either version 3, or (at your option)
74536c563SJohn Marino    any later version.
84536c563SJohn Marino 
94536c563SJohn Marino    This program is distributed in the hope that it will be useful,
104536c563SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
114536c563SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
124536c563SJohn Marino    GNU General Public License for more details.
134536c563SJohn Marino 
144536c563SJohn Marino    You should have received a copy of the GNU General Public License along
15*6ea1f93eSDaniel Fojt    with this program; if not, see <https://www.gnu.org/licenses/>.  */
164536c563SJohn Marino 
174536c563SJohn Marino #include <config.h>
184536c563SJohn Marino 
194536c563SJohn Marino /* Specification.  */
204536c563SJohn Marino #include "vasnprintf.h"
214536c563SJohn Marino 
224536c563SJohn Marino #include <stdarg.h>
234536c563SJohn Marino 
244536c563SJohn Marino char *
asnprintf(char * resultbuf,size_t * lengthp,const char * format,...)254536c563SJohn Marino asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
264536c563SJohn Marino {
274536c563SJohn Marino   va_list args;
284536c563SJohn Marino   char *result;
294536c563SJohn Marino 
304536c563SJohn Marino   va_start (args, format);
314536c563SJohn Marino   result = vasnprintf (resultbuf, lengthp, format, args);
324536c563SJohn Marino   va_end (args);
334536c563SJohn Marino   return result;
344536c563SJohn Marino }
35