--- clog_merge.c.orig	Mon Nov  9 14:37:49 1998
+++ clog_merge.c	Mon Nov  9 14:43:39 1998
@@ -1,10 +1,10 @@
-#if defined(HAVE_CONFIG_H) && !defined(MPICHCONF_INC)
+
 /* This includes the definitions found by configure, and can be found in
    the library directory (lib/$ARCH/$COMM) corresponding to this configuration
  */
 #define MPICHCONF_INC
 #include "mpichconf.h"
-#endif
+
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -234,68 +234,74 @@
     The byte ordering, if needed, will be performed in this
     function using the conversion routines got from Petsc.
 @*/
-void CLOG_output( buf )
-double *buf;
-{
-#if !(defined(WORDS_BIGENDIAN))
-  double *p = buf;
-  int         rtype;
-  CLOG_HEADER *h;
-  int rc;   
-  rtype = CLOG_UNDEF;
-
-  printf ("%s", "SWAPPING THE BYTES");
-  while (rtype != CLOG_ENDBLOCK && rtype != CLOG_ENDLOG) {
-    h	 = (CLOG_HEADER *) p;
-    rtype = h->rectype;
-    adjust_CLOG_HEADER (h); /* adjust the header record if needed */
-    p	 = (double *) (h->rest);	/* skip to end of header */
-    switch (rtype) {
-    case CLOG_MSGEVENT:
-      adjust_CLOG_MSG ((CLOG_MSG *)p);
-      p = (double *) (((CLOG_MSG *) p)->end);
-      break;
-    case CLOG_COLLEVENT:
-      adjust_CLOG_COLL ((CLOG_COLL *)p);
-      p = (double *) (((CLOG_COLL *) p)->end);
-      break;
-    case CLOG_RAWEVENT:
-      adjust_CLOG_RAW ((CLOG_RAW *)p);
-      p = (double *) (((CLOG_RAW *) p)->end);
-      break;
-    case CLOG_SRCLOC:
-      adjust_CLOG_SRC ((CLOG_SRC *)p);
-      p = (double *) (((CLOG_SRC *) p)->end);
-      break;
-    case CLOG_COMMEVENT:
-      adjust_CLOG_COMM ((CLOG_COMM *)p);
-      p = (double *) (((CLOG_COMM *) p)->end);
-      break;
-    case CLOG_STATEDEF:
-      adjust_CLOG_STATE ((CLOG_STATE *)p);
-      p = (double *) (((CLOG_STATE *) p)->end);
-      break;
-    case CLOG_EVENTDEF:
-      adjust_CLOG_EVENT ((CLOG_EVENT *)p);
-      p = (double *) (((CLOG_EVENT *) p)->end);
-      break;
-    case CLOG_ENDBLOCK:
-      break;
-    case CLOG_ENDLOG:
-      break;
-    default:
-      printf("unrecognized record type\n");
-    }
-  }
-#endif
+ void CLOG_output( buf )
+ double *buf;
+ {
+   int rc;   
+   char *env_log_format;
+ 
+ #ifndef WORDS_BIGENDIAN 
+   double *p = buf;
+   int         rtype;
+   CLOG_HEADER *h;
+   rtype = CLOG_UNDEF;
+ 
+   env_log_format = getenv("MPE_LOG_FORMAT");
+   if ( (env_log_format) && (strcmp(env_log_format, "CLOG") == 0) )
+   {
+       while (rtype != CLOG_ENDBLOCK && rtype != CLOG_ENDLOG) {
+          h      = (CLOG_HEADER *) p;
+          rtype = h->rectype;
+          adjust_CLOG_HEADER (h); /* adjust the header record if needed */
+          p      = (double *) (h->rest);        /* skip to end of header */
+          switch (rtype) {
+          case CLOG_MSGEVENT:
+              adjust_CLOG_MSG ((CLOG_MSG *)p);
+              p = (double *) (((CLOG_MSG *) p)->end);
+              break;
+          case CLOG_COLLEVENT:
+              adjust_CLOG_COLL ((CLOG_COLL *)p);
+              p = (double *) (((CLOG_COLL *) p)->end);
+              break;
+          case CLOG_RAWEVENT:
+              adjust_CLOG_RAW ((CLOG_RAW *)p);
+              p = (double *) (((CLOG_RAW *) p)->end);
+              break;
+          case CLOG_SRCLOC:
+              adjust_CLOG_SRC ((CLOG_SRC *)p);
+              p = (double *) (((CLOG_SRC *) p)->end);
+              break;
+          case CLOG_COMMEVENT:
+              adjust_CLOG_COMM ((CLOG_COMM *)p);
+              p = (double *) (((CLOG_COMM *) p)->end);
+              break;
+          case CLOG_STATEDEF:
+              adjust_CLOG_STATE ((CLOG_STATE *)p);
+              p = (double *) (((CLOG_STATE *) p)->end);
+              break;
+          case CLOG_EVENTDEF:
+              adjust_CLOG_EVENT ((CLOG_EVENT *)p);
+              p = (double *) (((CLOG_EVENT *) p)->end);
+              break;
+          case CLOG_ENDBLOCK:
+              break;
+          case CLOG_ENDLOG:
+              break;
+          default:
+              printf("unrecognized record type\n");
+          }
+       }
+   }
+ #endif
+ 
+     /* CLOG_dumpblock(buf);     temporary print for debugging*/
+     rc = write( logfd, buf, CLOG_BLOCK_SIZE ); /* write block to file */
+     if ( rc != CLOG_BLOCK_SIZE ) {
+        fprintf( stderr, "write failed for clog logging, rc = %d\n", rc );
+        exit (-1);
+     }
+ }
 
-    /* CLOG_dumpblock(buf);	 temporary print for debugging*/
-    rc = write( logfd, buf, CLOG_BLOCK_SIZE );	/* write block to file */
-    if ( rc != CLOG_BLOCK_SIZE ) {
-	fprintf( stderr, "write failed for clog logging, rc = %d\n", rc );
-	exit (-1);
-    }
-}
 
 /*@
     CLOG_cput - move a log record from one of the input buffers to the output
