Index: trunk/psLib/src/sys/psString.c
===================================================================
--- trunk/psLib/src/sys/psString.c	(revision 6989)
+++ trunk/psLib/src/sys/psString.c	(revision 7015)
@@ -13,6 +13,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-04-26 02:19:23 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-05-01 00:57:07 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -173,13 +173,16 @@
 }
 
+# if 0
 // XXX: This should probably be implemented using strpbrk
+// XXX : add a boolean "repeats significant"
+// XXX : NULL input string returns empty (not NULL) list
+// XXX : NULL splitters is an error
 psList *psStringSplit(const char *string,
                       const char *splitters)
 {
+    PS_ASSERT_PTR_NON_NULL(splitters, NULL);
+
     psList *values = psListAlloc(NULL); // The list of values to return
     PS_ASSERT_PTR_NON_NULL(string, values);
-    PS_ASSERT_PTR_NON_NULL(splitters, values);
-    //    if (string == NULL)
-    //        return values;
 
     unsigned int length = strlen(string); // The length of the string
@@ -215,4 +218,45 @@
     return values;
 }
+# endif
+
+// split the string by the given splitters
+// NULL input string returns empty (not NULL) list
+// NULL splitters is an error
+psList *psStringSplit(const char *string,
+                      const char *splitters,
+                      bool multipleAreSignificant)
+{
+    PS_ASSERT_PTR_NON_NULL(splitters, NULL);
+
+    psList *values = psListAlloc(NULL); // The list of values to return
+    PS_ASSERT_PTR_NON_NULL(string, values);
+
+    char *next = NULL;
+    char *current = (char *) string;
+    while ((next = strpbrk (current, splitters)) != NULL) {
+
+        // are multiple splitters in-a-row significant?
+        if ((next == current) && !multipleAreSignificant) {
+            current ++;
+            continue;
+        }
+
+        // Copy the current word
+        psString word = psStringNCopy(current, next - current);
+        psListAdd(values, PS_LIST_TAIL, word);
+        psFree(word);
+
+        current = next + 1;
+    }
+
+    if (strlen(current) > 0) {
+        // Copy the last word
+        psString word = psStringCopy(current);
+        (void)psListAdd(values, PS_LIST_TAIL, word);
+        psFree(word);
+    }
+
+    return values;
+}
 
 // given the input string, search for all copies of the key, and replace with the replacement value
