stralloc/stralloc_catf.c

Go to the documentation of this file.
00001 // Copyright (C) 2006-2007 Benedikt Böhm <hollow@gentoo.org>
00002 //
00003 // This program is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU General Public License
00005 // as published by the Free Software Foundation; either version 2
00006 // of the License, or (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00016 
00017 #include <stdarg.h>
00018 
00019 #include "mem.h"
00020 #include "printf.h"
00021 #include "stralloc.h"
00022 
00023 int stralloc_catf(stralloc_t *dst, const char *fmt, ...)
00024 {
00025         va_list ap;
00026         char *buf;
00027         int rc;
00028 
00029         va_start(ap, fmt);
00030 
00031         if (_lucid_vasprintf(&buf, fmt, ap) == -1) {
00032                 va_end(ap);
00033                 return -1;
00034         }
00035 
00036         va_end(ap);
00037 
00038         rc = stralloc_cats(dst, buf);
00039 
00040         mem_free(buf);
00041 
00042         return rc;
00043 }

Generated on Tue Jun 19 20:38:27 2007 for lucid by  doxygen 1.5.2