[Portability] Implemented snprintf() function to support old compilers
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3290 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/os/print.c b/common/os/print.c
index f24717f..0f26de3 100644
--- a/common/os/print.c
+++ b/common/os/print.c
@@ -89,3 +89,16 @@
}
#endif /* HAVE_VSNPRINTF */
+#ifndef HAVE_SNPRINTF
+int tight_snprintf(char *str, size_t n, const char *format, ...) {
+ va_list ap;
+ int written;
+
+ va_start(ap, format);
+ written = vsnprintf(str, n, format, ap);
+ va_end(ap);
+
+ return written;
+}
+#endif /* HAVE_SNPRINTF */
+