Added snprintf/vsnprintf wrappers for systems that don't have
[yaz-moved-to-github.git] / src / snprintf.c
1 /*
2  * Copyright (C) 2007, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: snprintf.c,v 1.1 2007-02-23 10:15:01 adam Exp $
6  */
7 /**
8  * \file snprintf.c
9  * \brief snprintf wrapper
10  */
11
12 #include <stdlib.h>
13 #include <stdarg.h>
14 #include <yaz/snprintf.h>
15
16 void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
17 {
18 #if HAVE_VSNPRINF
19     vsnprintf(buf, size, fmt, ap);
20 #else
21 #ifdef WIN32
22     _vsnprintf(buf, size, fmt, ap);
23 #else
24     vsprintf(buf, fmt, ap);
25 #endif
26 #endif
27 }
28
29 void yaz_snprintf(char *buf, size_t size, const char *fmt, ...)
30 {
31     va_list ap;
32     va_start(ap, fmt);
33     yaz_vsnprintf(buf, size, fmt, ap);
34     va_end(ap);
35 }
36
37 /*
38  * Local variables:
39  * c-basic-offset: 4
40  * indent-tabs-mode: nil
41  * End:
42  * vim: shiftwidth=4 tabstop=8 expandtab
43  */
44