Index: trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- trunk/psLib/src/sys/psLogMsg.c	(revision 4540)
+++ trunk/psLib/src/sys/psLogMsg.c	(revision 4951)
@@ -12,6 +12,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-07 00:15:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -37,4 +37,5 @@
 #include <time.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #include "psLogMsg.h"
@@ -87,9 +88,10 @@
  An psBool: TRUE if successful.
  *****************************************************************************/
-bool psLogSetDestination(const char *dest)
+bool psLogSetDestination(int fd)
 {
-    char protocol[5];
-    char location[257];
-
+    //    char protocol[5];
+    //    char location[257];
+    //    char dest[257];
+    FILE *fp;
     // if logDest has not been initialized, do so before using it
     if (logDest == (FILE *) 1) {
@@ -97,55 +99,85 @@
     }
 
-    if (dest == NULL || strcmp(dest, "none") == 0) {
+    if ( fd == 1 ) {
+        //        fp = stdout;
         if (logDest != NULL && logDest != stderr && logDest != stdout) {
             fclose(logDest);
         }
+        logDest = stdout;
+    } else if (fd == 2) {
+        //        fp = stderr;
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = stderr;
+    } else if (fd == 0) {
+        //        fp = NULL;
+        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) {
+    } else if (fd > 2) {
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        fp = fdopen(fd, "w");
+        logDest = fp;
+        //        fclose(fp);
+        return true;
+    }
+
+    /*
+        if (dest == NULL || strcmp(dest, "none") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
             }
-            logDest = stderr;
+            logDest = NULL;
             return true;
         }
-        if (strcmp(location, "stdout") == 0) {
+        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 = stdout;
+            logDest = file;
             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;
-    }
-
-    psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
-            protocol);
-    return false;
+    */
+    return true;
+
 }
 
