Index: trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- trunk/psLib/src/sys/psLogMsg.c	(revision 4974)
+++ trunk/psLib/src/sys/psLogMsg.c	(revision 4979)
@@ -12,6 +12,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-07 00:36:12 $
+ *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-09 01:11:22 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -90,7 +90,4 @@
 bool psLogSetDestination(int fd)
 {
-    //    char protocol[5];
-    //    char location[257];
-    //    char dest[257];
     FILE *fp;
     // if logDest has not been initialized, do so before using it
@@ -98,4 +95,6 @@
         logDest = stderr;
     }
+    if (fd == -1)
+        return false;
 
     if ( fd == 1 ) {
@@ -117,5 +116,5 @@
         }
         logDest = NULL;
-        return true;
+        //        return true;
     } else if (fd > 2) {
         if (logDest != NULL && logDest != stderr && logDest != stdout) {
@@ -125,57 +124,7 @@
         logDest = fp;
         //        fclose(fp);
-        return true;
-    }
-
-    /*
-        if (dest == NULL || strcmp(dest, "none") == 0) {
-            if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                fclose(logDest);
-            }
-            logDest = NULL;
-            return true;
-        }
-        if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
-            psError(PS_ERR_LOCATION_INVALID, true,
-                    PS_ERRORTEXT_psLogMsg_DESTINATION_MALFORMED,
-                    dest);
-            return false;
-        }
-    */
-    /*
-
-        if (strcmp(protocol, "dest") == 0) {
-            if (strcmp(location, "stderr") == 0) {
-                if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                    fclose(logDest);
-                }
-                logDest = stderr;
-                return true;
-            }
-            if (strcmp(location, "stdout") == 0) {
-                if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                    fclose(logDest);
-                }
-                logDest = stdout;
-                return true;
-            }
-            psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
-                    location);
-            return 1;
-        } else if (strcmp(protocol, "file") == 0) {
-            FILE *file = fopen(location, "w");
-
-            if (file == NULL) {
-                psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
-                        location);
-                return false;
-            }
-            if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                fclose(logDest);
-            }
-            logDest = file;
-            return true;
-        }
-    */
+        //        return true;
+    }
+
     return true;
 
@@ -253,4 +202,61 @@
 }
 
+int psMessageDestination (const char *dest)
+{
+    char protocol[5];
+    char location[257];
+    if (logDest == (FILE *) 1) {
+        logDest = stderr;
+    }
+
+    if (dest == NULL || strcmp(dest, "none") == 0) {
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = NULL;
+        return 0;
+    }
+    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
+        psError(PS_ERR_LOCATION_INVALID, true,
+                PS_ERRORTEXT_psLogMsg_DESTINATION_MALFORMED,
+                dest);
+        return -1;
+    }
+    if (strcmp(protocol, "dest") == 0) {
+        if (strcmp(location, "stderr") == 0) {
+            if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                fclose(logDest);
+            }
+            logDest = stderr;
+            return 2;
+        }
+        if (strcmp(location, "stdout") == 0) {
+            if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                fclose(logDest);
+            }
+            logDest = stdout;
+            return 1;
+        }
+        psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
+                location);
+        return -1;
+    } else if (strcmp(protocol, "file") == 0) {
+        //        FILE *file = fopen(location, "w");
+        int fileD = creat(location, 0666);
+
+        if (fileD == 0) {
+            psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
+                    location);
+            return -1;
+        }
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = fdopen(fileD, "w");
+        return fileD;
+    }
+    return -1;
+}
+
 #ifndef HOST_NAME_MAX                // should be in limits.h
 #define HOST_NAME_MAX 256
Index: trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- trunk/psLib/src/sys/psLogMsg.h	(revision 4974)
+++ trunk/psLib/src/sys/psLogMsg.h	(revision 4979)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-07 00:36:12 $
+ *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-09 01:11:22 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -61,4 +61,14 @@
 );
 
+/** This procedures uses a string to set the destination for which to send
+ *  the corresponding log messages.
+ *
+ *
+ *  @return int:        The file descriptor location of the message.
+ */
+int psMessageDestination(
+    const char *dest                   ///< Specifies where to send the message
+);
+
 /** This procedure logs a message to the destination set by a prior
  *  call to psLogSetDestination(), if myLevel is less than the level
