X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsnprintf.c;fp=src%2Fsnprintf.c;h=fccf3b0dd73f14c2e46dc76d426fbfe1bae7eab8;hp=0000000000000000000000000000000000000000;hb=021f5586a328c6600460aa9f9be664ba19ba20d4;hpb=acf93c6b774c7184c35c2b994d4d7764438656d8 diff --git a/src/snprintf.c b/src/snprintf.c new file mode 100644 index 0000000..fccf3b0 --- /dev/null +++ b/src/snprintf.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007, Index Data ApS + * See the file LICENSE for details. + * + * $Id: snprintf.c,v 1.1 2007-02-23 10:15:01 adam Exp $ + */ +/** + * \file snprintf.c + * \brief snprintf wrapper + */ + +#include +#include +#include + +void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) +{ +#if HAVE_VSNPRINF + vsnprintf(buf, size, fmt, ap); +#else +#ifdef WIN32 + _vsnprintf(buf, size, fmt, ap); +#else + vsprintf(buf, fmt, ap); +#endif +#endif +} + +void yaz_snprintf(char *buf, size_t size, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + yaz_vsnprintf(buf, size, fmt, ap); + va_end(ap); +} + +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +