Index: trunk/psLib/src/sys/psString.c
===================================================================
--- trunk/psLib/src/sys/psString.c	(revision 8415)
+++ trunk/psLib/src/sys/psString.c	(revision 8598)
@@ -13,6 +13,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-18 01:59:13 $
+ *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-25 21:50:07 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -98,6 +98,17 @@
                        ...)
 {
+    va_list ap;
+    va_start(ap, format);
+    ssize_t length = psStringAppendV(dest, format, ap);
+    va_end(ap);
+
+    return length;
+}
+
+ssize_t psStringAppendV(char **dest,
+                        const char *format,
+                        va_list ap)
+{
     PS_ASSERT_PTR_NON_NULL(format, 0);
-    va_list         args;
     size_t          length;             // complete string length (sans \0)
     size_t          oldLength;          // original string length (sans \0)
@@ -115,8 +126,9 @@
 
     // find the size of the string to append
-    va_start(args, format);
+    va_list         apCopy;
     // C99 guarentees vsnprintf() to work as expected with size = 0
-    tailLength = vsnprintf(*dest, 0, format, args);
-    va_end(args);
+    va_copy(apCopy, ap);
+    tailLength = vsnprintf(*dest, 0, format, apCopy);
+    va_end(apCopy);
 
     // if the new tail is zero length, return the length of the old string.  if
@@ -134,7 +146,10 @@
 
     // append tail + \0
-    va_start(args, format);
-    vsnprintf(*dest + oldLength, tailLength + 1, format, args);
-    va_end(args);
+    // XXX this second call to va_copy() isn't strictly nessicary as the
+    // calling function can't assume we won't modify the va_list.  However, we
+    // have decided to error on the side of caution.
+    va_copy(apCopy, ap);
+    vsnprintf(*dest + oldLength, tailLength + 1, format, apCopy);
+    va_end(apCopy);
 
     return length;
