Index: /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.c
===================================================================
--- /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.c	(revision 29811)
+++ /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.c	(revision 29812)
@@ -27,5 +27,22 @@
 #include "psMemory.h"
 
-#define SLURP_SIZE 4096
+# define SLURP_SIZE 4096
+
+# if (PS_SLURP_GZIP) 
+
+psString psSlurpFD(int fd) {
+
+ gzFile file = gzdopen (fd, "r");
+ if (file == Z_NULL) {
+     psError(PS_ERR_IO, true, "Failed to open file\n");
+     return NULL;
+ }
+ 
+ psString str = psSlurpGZIP(file);
+
+ return str;
+}
+
+# else
 
 psString psSlurpFD(int fd)
@@ -59,5 +76,38 @@
     return str;
 }
+# endif
 
+# if (PS_SLURP_GZIP)
+psString psSlurpGZIP(gzFile fd)
+{
+    psString str = NULL;                // String to which to write
+    size_t size  = 1;                   // bytes allocated -  make sure there is room for '\0'
+    size_t used = 0;                    // bytes actually used
+    ssize_t bytes;                      // Number of bytes read
+    do {
+        // increase the allocated string size
+        size += SLURP_SIZE;
+        str = psStringRealloc(str, size);
+
+        // read a block from the stream
+        bytes = gzread(fd, str + used, SLURP_SIZE);
+        if (bytes < 0) {
+            // it's an error
+            psError(PS_ERR_IO, true, "slurp failed on read");
+            psFree(str);
+            return NULL;
+        }
+
+        // Increase the size of the known string
+        used += bytes;
+
+    } while (bytes != 0);
+
+    // append '\0' to the end of the string
+    str[used] = '\0';
+
+    return str;
+}
+# endif
 
 psString psSlurpFile(FILE *stream)
@@ -70,4 +120,20 @@
 {
     PS_ASSERT_PTR_NON_NULL(filename, NULL);
+    
+# if (PS_SLURP_GZIP)
+    gzFile fd = gzopen(filename, "r");
+    if (fd == Z_NULL) {
+        psError(PS_ERR_IO, true, "Failed to open specified file, %s\n", filename);
+        return NULL;
+    }
+    psString text = psSlurpGZIP(fd);
+
+    if (gzclose(fd) != Z_OK) {
+        psError(PS_ERR_IO, true, "Failed to close specified file, %s\n", filename);
+        psFree(text);
+        return NULL;
+    }
+
+# else
 
     int fd = open(filename, O_RDONLY);
@@ -76,5 +142,4 @@
         return NULL;
     }
-
     psString text = psSlurpFD(fd);
 
@@ -84,4 +149,5 @@
         return NULL;
     }
+# endif
 
     return text;
Index: /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.h
===================================================================
--- /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.h	(revision 29811)
+++ /branches/eam_branches/ipp-20101103/psLib/src/sys/psSlurp.h	(revision 29812)
@@ -12,4 +12,10 @@
 
 #include <psString.h>
+
+# define PS_SLURP_GZIP 1
+
+# if (PS_SLURP_GZIP) 
+# include <zlib.h>
+# endif
 
 /// @addtogroup FileIO Input/Output
@@ -31,4 +37,8 @@
                     );
 
+# if (PS_SLURP_GZIP)
+psString psSlurpGZIP(gzFile fd);
+# endif
+
 /// @}
 #endif
Index: /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.c
===================================================================
--- /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.c	(revision 29811)
+++ /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.c	(revision 29812)
@@ -1630,24 +1630,75 @@
 }
 
-
+# if (PS_SLURP_GZIP)
 bool psMetadataConfigWrite(psMetadata *md,
-                           const char *filename)
+                           const char *filename, const char *compress)
 {
     PS_ASSERT_METADATA_NON_NULL(md, NULL);
     PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
-    FILE *file;
-    if ( !(file = fopen(filename, "w")) ) {
-        psError(PS_ERR_IO, true,
-                "Failed to open specified file, %s\n", filename);
-        return false;
-    }
+
+    char modeString[4];
+
+    if (compress) {
+	if (strlen(compress) > 2) {
+	    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "invalid compression options %s", compress);
+	    return false;
+	}
+	snprintf (modeString, 4, "w%s", compress);
+    } else {
+	strcpy (modeString, "w");
+    }	
+
+    gzFile file = gzopen(filename, modeString);
+    if (file == Z_NULL) {
+        psError(PS_ERR_IO, true, "Failed to open specified file, %s\n", filename);
+        return false;
+    }
+
     psString fileString = NULL;
     fileString = psMetadataConfigFormat(md);
     if (fileString == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, false,
-                "psMetadataConfigFormat returned NULL.\n");
-        return false;
-    }
-    if (fprintf(file, "%s", fileString) != strlen(fileString)) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, false, "psMetadataConfigFormat returned NULL.\n");
+        return false;
+    }
+
+    int nbytes = gzwrite (file, fileString, strlen(fileString));
+    if (nbytes != strlen(fileString)) {
+        psError(PS_ERR_IO, true, "Failed to write contents of configuration file %s", filename);
+        psFree(fileString);
+        gzclose(file);
+        return false;
+    }
+    psFree(fileString);
+    if (gzclose(file) != Z_OK) {
+        psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename);
+        return false;
+    }
+    return true;
+}
+
+# else
+
+bool psMetadataConfigWrite(psMetadata *md,
+                           const char *filename, const char *compress)
+{
+    PS_ASSERT_METADATA_NON_NULL(md, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
+
+    FILE *file = fopen(filename, "w");
+    if (file == NULL) {
+        psError(PS_ERR_IO, true,
+                "Failed to open specified file, %s\n", filename);
+        return false;
+    }
+
+    psString fileString = NULL;
+    fileString = psMetadataConfigFormat(md);
+    if (fileString == NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, false, "psMetadataConfigFormat returned NULL.\n");
+        return false;
+    }
+
+    int nbytes = fwrite(fileString, 1, strlen(fileString), file);
+    if (nbytes != strlen(fileString)) {
         psError(PS_ERR_IO, true, "Failed to write contents of configuration file %s", filename);
         psFree(fileString);
@@ -1657,10 +1708,10 @@
     psFree(fileString);
     if (fclose(file) == EOF) {
-        psError(PS_ERR_IO, true,
-                "Failed to close file, %s\n", filename);
+        psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename);
         return false;
     }
     return true;
 }
+# endif /* PS_SLURP_GZIP */
 
 bool psMetadataConfigPrint(FILE *stream,
Index: /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.h
===================================================================
--- /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.h	(revision 29811)
+++ /branches/eam_branches/ipp-20101103/psLib/src/types/psMetadataConfig.h	(revision 29812)
@@ -33,4 +33,5 @@
  *  a string, the formatting command must also be for a string. If the
  *  metadata type is any other data type, printing is not allowed.
+ *  Currently, this function does not compress the output file
  *
  * @return psMetadataItem* :    Pointer metadata item.
@@ -85,9 +86,11 @@
 bool psMetadataConfigWrite(
     psMetadata *md,                    ///< The metadata to convert
-    const char *filename               ///< Name of file to write
+    const char *filename,	       ///< Name of file to write
+    const char *compress	       ///< Output compression options 
 );
 
 /** Converts a psMetadata structure (including any nested psMetadata) into a
  *  configuration file formatted string that is written a file stream.
+ *  Currently, this function does not compress the output file
  *
  *  @return bool:       True if successful, otherwise false.
