--- snprintf_1.3/snprintf.c	Wed Jun 30 15:21:59 1999
+++ snprintf_1.4/snprintf.c	Thu May  4 14:23:01 2000
@@ -190,22 +190,36 @@
 #if !defined(HAVE_SNPRINTF)
 /* declare our portable routine under name snprintf */
 #define portable_snprintf snprintf
+/* declare our portable routine under name vsnprintf */
+#define portable_vsnprintf vsnprintf
 #else
 /* declare our portable routine under name portable_snprintf */
+/* declare our portable routine under name portable_vsnprintf */
 #endif
 
-/* prototype */
+/* prototypes */
 int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
+int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
 
 /* declaration */
 int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...) {
-  va_list ap;
+	int rv;
+	va_list ap;
+	va_start(ap, fmt);
+	rv = portable_vsnprintf(str, str_m, fmt, ap);
+	va_end(ap);
+	return rv;
+}
+
+/* declaration */
+int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
   size_t str_l = 0;
   const char *p = fmt;
 
-  if (str_m < 1) return -1;
+  /*standard now says that str can be NULL and str_m can be 0*/
+  /*if (str_m < 1) return -1;*/
 
-  va_start(ap, fmt);
+/*  va_start(ap, fmt);*/
   if (!p) p = "";
   while (*p) {
     if (*p != '%') {
@@ -558,10 +572,12 @@
       }
     }
   }
-  va_end(ap);
+/*va_end(ap);*/
+
   if (str_m > 0)  /* make sure the string is null-terminated
                      even at the expense of overwriting the last character */
     str[str_l <= str_m-1 ? str_l : str_m-1] = '\0';
+  
   return str_l;  /* return the number of characters formatted
                     (excluding trailing null character),
                     that is, the number of characters that would have been
--- snprintf_1.3/snprintf.h	Wed Jun 30 15:03:59 1999
+++ snprintf_1.4/snprintf.h	Thu May  4 13:51:54 2000
@@ -2,17 +2,20 @@
 #define _PORTABLE_SNPRINTF_H_
 
 #define PORTABLE_SNPRINTF_VERSION_MAJOR 1
-#define PORTABLE_SNPRINTF_VERSION_MINOR 3
+#define PORTABLE_SNPRINTF_VERSION_MINOR 4
 
 #ifdef HAVE_SNPRINTF
 #include <stdio.h>
 #else
 extern int snprintf(char *, size_t, const char *, /*args*/ ...);
+extern int vsnprintf(char *, size_t, const char *, va_list);
 #endif
 
 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
 extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
 #define snprintf portable_snprintf
+extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list va);
+#define vsnprintf portable_vsnprintf
 #endif
 
 #endif

