1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1996, 1997, 1998, 1999
5  *	Sleepycat Software.  All rights reserved.
6  */
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif /* HAVE_CONFIG_H */
11 
12 #ifndef HAVE_VSNPRINTF
13 
14 #ifndef NO_SYSTEM_INCLUDES
15 #include <sys/types.h>
16 
17 #include <stdio.h>
18 #ifdef __STDC__
19 #include <stdarg.h>
20 #else
21 #include <varargs.h>
22 #endif
23 #endif
24 
25 /*
26  * vsnprintf --
27  *	Bounded version of vsprintf.
28  *
29  * PUBLIC: #ifndef HAVE_VSNPRINTF
30  * PUBLIC: int vsnprintf();
31  * PUBLIC: #endif
32  */
33 
34 int
vsnprintf(str,n,fmt,ap)35 vsnprintf(str, n, fmt, ap)
36 	char *str;
37 	size_t n;
38 	const char *fmt;
39 	va_list ap;
40 {
41 	n = 0;
42 
43 #ifdef SPRINTF_RET_CHARPNT
44 	(void)vsprintf(str, fmt, ap);
45 	return (strlen(str));
46 #else
47 	return (vsprintf(str, fmt, ap));
48 #endif
49 }
50 #endif /* HAVE_VSNPRINTF */
51 
52