Index: /trunk/archive/pslib/include/psError.h
===================================================================
--- /trunk/archive/pslib/include/psError.h	(revision 455)
+++ /trunk/archive/pslib/include/psError.h	(revision 456)
@@ -34,4 +34,5 @@
 void psErrorClear(void);		///< Clear the error stack
 
+const char *psErrorCodeString(psErrorCode code);	///< return the string associated with the error code
 void psErrorStackPrint(FILE *fd, const char *fmt, ...);	///< print the errorstack to this file descriptor
 void psVErrorStackPrint(FILE *fd,	//< write to this file descriptor
Index: /trunk/archive/pslib/src/Utils/error.c
===================================================================
--- /trunk/archive/pslib/src/Utils/error.c	(revision 455)
+++ /trunk/archive/pslib/src/Utils/error.c	(revision 456)
@@ -139,4 +139,35 @@
 
 /************************************************************************************************************/
+
+static void
+build_errorStringList(void)
+{
+    for (int i = 0; i < PS_ERR_N_ERR_CLASSES; i++) {
+	errorStringList[i] = NULL;
+    }
+    
+    for (int i = 0; i < PS_ERR_N_ERR_CLASSES; i++) {
+	if (errorStrings[i].descrip == NULL) {
+	    break;
+	}
+	
+	errorStringList[errorStrings[i].code] = errorStrings[i].descrip;
+    }
+}
+
+/************************************************************************************************************/
+/*
+ * Return the string associated with an error code
+ */
+const char *psErrorCodeString(psErrorCode code)
+{
+    if (errorStringList[PS_ERR_UNKNOWN] == NULL) { // need to build the errorStringList
+	build_errorStringList();
+    }
+
+    return (code < PS_ERR_BASE ? strerror(code) : errorStringList[code]);
+}
+
+/************************************************************************************************************/
 /*
  * Print the header then error stack to the provided file descriptor
@@ -165,20 +196,6 @@
 			va_list ap)	// arguments for format
 {
-    static int first = 1;
-    
-    if (first) {			// need to build the errorStringList
-	first = 0;
-
-	for (int i = 0; i < PS_ERR_N_ERR_CLASSES; i++) {
-	    errorStringList[i] = NULL;
-	}
-
-	for (int i = 0; i < PS_ERR_N_ERR_CLASSES; i++) {
-	    if (errorStrings[i].descrip == NULL) {
-		break;
-	    }
-	    
-	    errorStringList[errorStrings[i].code] = errorStrings[i].descrip;
-	}
+    if (errorStringList[PS_ERR_UNKNOWN] == NULL) { // need to build the errorStringList
+	build_errorStringList();
     }
 
@@ -208,6 +225,5 @@
 	int code = stack[i]->error.code;
 	fprintf(fd, "%*s%-*s %-30s %s\n",
-		i, "", 30 - i, stack[i]->error.name,
-		(code < PS_ERR_BASE ? strerror(code) : errorStringList[code]), stack[i]->error.msg);
-    }
-}
+		i, "", 30 - i, stack[i]->error.name, psErrorCodeString(code), stack[i]->error.msg);
+    }
+}
