Index: /trunk/psLib/src/sys/psSlurp.c
===================================================================
--- /trunk/psLib/src/sys/psSlurp.c	(revision 8995)
+++ /trunk/psLib/src/sys/psSlurp.c	(revision 8996)
@@ -5,6 +5,6 @@
  *  @author Joshua Hoblitt, University of Hawaii
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-09-27 00:43:31 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-09-27 00:59:58 $
  *
  *  Copyright 2006 University of Hawaii
@@ -15,5 +15,5 @@
 #endif
 
-#include <stdio.h>
+#include <unistd.h>
 
 #include "psError.h"
@@ -21,14 +21,7 @@
 #include "psMemory.h"
 
-# define SLURP_SIZE 1024
+#define SLURP_SIZE 4096
 
-psString psSlurp(int fd)
-{
-    FILE *stream = fdopen(fd, "r");
-
-    return psSlurpFile(stream);
-}
-
-psString psSlurpFile(FILE *stream)
+psString psSlurpFD(int fd)
 {
     psString str    = NULL;
@@ -42,18 +35,18 @@
 
         // read a block from the stream
-        size_t bytes = fread(str + used, 1, SLURP_SIZE, stream);
-        used += bytes;
-
-        // is this the end of the file or an error?
-        if (bytes != SLURP_SIZE) {
-            if (feof(stream)) {
-                // eof
-                break;
-            }
-            // else - it's an error
-            psError(PS_ERR_UNKNOWN, true, "slurp failed");
+        ssize_t bytes = read(fd, str + used, SLURP_SIZE);
+        if (bytes < 0) {
+            // it's an error
+            psError(PS_ERR_IO, true, "slurp failed");
             psFree(str);
             return NULL;
         }
+
+        // is this the end of the file?
+        if (bytes == SLURP_SIZE) {
+            break;
+        }
+
+        used += bytes;
     }
 
@@ -63,2 +56,7 @@
     return str;
 }
+
+psString psSlurpFile(FILE *stream)
+{
+    return psSlurpFD(fileno(stream));
+}
Index: /trunk/psLib/src/sys/psSlurp.h
===================================================================
--- /trunk/psLib/src/sys/psSlurp.h	(revision 8995)
+++ /trunk/psLib/src/sys/psSlurp.h	(revision 8996)
@@ -2,4 +2,4 @@
 #include <pslib.h>
 
-psString psSlurp(int fd);
+psString psSlurpFD(int fd);
 psString psSlurpFile(FILE *stream);
