0221f977b31cd1ed6ae078e3986fbc6fafe2856e
[yaz-moved-to-github.git] / src / snprintf.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2008 Index Data
3  * See the file LICENSE for details.
4  */
5 /**
6  * \file snprintf.c
7  * \brief snprintf wrapper
8  */
9
10 #include <stdlib.h>
11 #include <stdarg.h>
12 #include <yaz/snprintf.h>
13
14 void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
15 {
16 #if HAVE_VSNPRINTF
17     vsnprintf(buf, size, fmt, ap);
18 #else
19 #ifdef WIN32
20     _vsnprintf(buf, size, fmt, ap);
21 #else
22     vsprintf(buf, fmt, ap);
23 #endif
24 #endif
25 }
26
27 void yaz_snprintf(char *buf, size_t size, const char *fmt, ...)
28 {
29     va_list ap;
30     va_start(ap, fmt);
31     yaz_vsnprintf(buf, size, fmt, ap);
32     va_end(ap);
33 }
34
35 /*
36  * Local variables:
37  * c-basic-offset: 4
38  * indent-tabs-mode: nil
39  * End:
40  * vim: shiftwidth=4 tabstop=8 expandtab
41  */
42