Date: Sat Feb 15 21:47:11 CET 2003
User: Derick Rethans
Directory: srm/main/src
Log Message:
[0.25]
- Added srm_sprintf()
Modified files:
srm/main/src/srm_compat.c (version: 1.17)
srm/main/src/srm_compat.h (version: 1.9)
[FILE: /srm/main/src/srm_compat.c]
--- srm/main/src/srm_compat.c:1.16 Sat Jan 18 15:11:29 2003 GMT
+++ srm/main/src/srm_compat.c Sat Feb 15 19:47:10 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.16 2003/01/18 16:11:29 derick Exp $ */
+/* $Id: cvstemp,v 1.17 2003/02/15 20:47:10 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -66,3 +66,28 @@
select (0, NULL, NULL, NULL, &to);
}
+char *srm_sprintf (const char* fmt, ...)
+{
+ char *new_str;
+ int size = 1;
+ va_list args;
+
+ new_str = (char *) malloc (size);
+
+ va_start(args, fmt);
+ for (;;) {
+ int n = vsnprintf (new_str, size, fmt, args);
+ if (n > -1 && n < size) {
+ break;
+ }
+ if (n < 0) {
+ size *= 2;
+ } else {
+ size = n + 1;
+ }
+ new_str = (char *) realloc (new_str, size);
+ }
+ va_end (args);
+
+ return new_str;
+}
[FILE: /srm/main/src/srm_compat.h]
--- srm/main/src/srm_compat.h:1.8 Thu Feb 07 12:51:38 2002 GMT
+++ srm/main/src/srm_compat.h Sat Feb 15 19:47:10 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.8 2002/02/07 13:51:38 derick Exp $ */
+/* $Id: cvstemp,v 1.9 2003/02/15 20:47:10 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -24,6 +24,7 @@
inline char *srm_gethostbyaddr (const char *addr, int len, int type);
void srm_sleep (int sec, int usec);
+char *srm_sprintf (const char* fmt, ...);
#ifdef WIN32
# define vsnprintf _vsnprintf
Received on Sat Feb 15 21:35:28 2003
This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 12:00:03 CET