1 //
2 // String_fmt.cc
3 //
4 // String_fmt: Formatting functions for the String class. Those functions
5 //             are also used in other files, they are not purely internal
6 //             to the String class.
7 //
8 // Part of the ht://Dig package   <http://www.htdig.org/>
9 // Copyright (c) 1999-2004 The ht://Dig Group
10 // For copyright details, see the file COPYING in your distribution
11 // or the GNU Library General Public License (LGPL) version 2 or later
12 // <http://www.gnu.org/copyleft/lgpl.html>
13 //
14 // $Id: String_fmt.cc,v 1.11 2004/05/28 13:15:21 lha Exp $
15 //
16 
17 #ifdef HAVE_CONFIG_H
18 #include "htconfig.h"
19 #endif /* HAVE_CONFIG_H */
20 
21 #include "htString.h"
22 
23 #include <stdarg.h>
24 #include <stdio.h>
25 
26 #ifdef _MSC_VER /* _WIN32 */
27 #define vsnprintf _vsnprintf
28 #endif
29 
30 static char	buf[10000];
31 
32 //*****************************************************************************
33 // char *form(char *fmt, ...)
34 //
form(const char * fmt,...)35 char *form(const char *fmt, ...)
36 {
37 	va_list	args;
38 	va_start(args, fmt);
39 	vsnprintf(buf, sizeof(buf), fmt, args);
40 	va_end(args);
41 	return buf;
42 }
43 
44 
45 //*****************************************************************************
46 // char *vform(char *fmt, va_list args)
47 //
vform(const char * fmt,va_list args)48 char *vform(const char *fmt, va_list args)
49 {
50 	vsnprintf(buf, sizeof(buf), fmt, args);
51 	return buf;
52 }
53 
54 
55