Index: /trunk/ippTools/src/pzgetexp.c
===================================================================
--- /trunk/ippTools/src/pzgetexp.c	(revision 6836)
+++ /trunk/ippTools/src/pzgetexp.c	(revision 6837)
@@ -3,13 +3,11 @@
 
 #include "pxtools.h"
+#include "pzgetexp.h"
 
-//static psString slurp(FILE *stream);
-static bool parseInput();
+static bool parseInput(pxConfig *config);
 
 int main(int argc, char **argv)
 {
-//    pxConfig *config = pxConfigAlloc();
-
-//    pzsearchConfig(config, argc, argv);
+    pxConfig *config = pzgetexpConfig(config, argc, argv);
 
     /*
@@ -25,5 +23,5 @@
     */
 
-    parseInput();
+    parseInput(config);
 
     exit(EXIT_SUCCESS);
@@ -34,44 +32,56 @@
 }
 
-static bool parseInput() 
+static bool parseInput(pxConfig *config) 
 {
     psString input = slurp(stdin);
-    psList *tokens = psStringSplit(input, " ");
+    psList *lines = psStringSplit(input, "\n");
 
-}
+    psListIterator *lineCursor = psListIteratorAlloc(lines, 0, false);
 
-/*
-#define SLURP_SIZE 1024
-static psString slurp(FILE *stream) 
-{
-    psString str    = NULL;
-    size_t strSize  = 1; // bytes allocated -  make sure there is room for '\0'
-    size_t used     = 0; // bytes actually used
+    psArray *summitExps = psArrayAlloc(psListLength(lines));
+    psString    item;
+    while ((item = psListGetAndIncrement(lineCursor))) {
+        printf("-> %s\n", item);
 
-    for (;;) {
-        // increase the allocated string size
-        strSize += SLURP_SIZE;
-        str = psRealloc(str, strSize);
+        // split line into tokens
+        psList *tokens = psStringSplit(item, " ");
 
-        // read a block from the stream
-        size_t bytes = fread(str + used, 1, SLURP_SIZE, stream); 
-        used += bytes;
+        // check that we have the right number of tokens
+        // print "# uri fileset datetime type\n";
+        if (psListLength(tokens) != 4) {
+            // error
+            return false;
+        }
 
-        // 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");
-            return NULL;
+        psListIterator *tokenCursor = psListIteratorAlloc(tokens, 0, false);
+
+        char *uri       = psListGetAndIncrement(tokenCursor);
+        char *exp_id    = psListGetAndIncrement(tokenCursor); // fileset
+        char *time      = psListGetAndIncrement(tokenCursor); // datetime 
+        char *exp_type  = psListGetAndIncrement(tokenCursor); // type
+
+        psFree(tokenCursor);
+
+        summitExpRow *row = summitExpRowAlloc(
+            exp_id,
+            config->camera,
+            config->telescope,
+            exp_type,
+            uri
+        );
+        psArrayAdd(summitExps, 0, row);
+    }
+    
+    psFree(lineCursor);
+    psFree(lines);
+    psFree(input);
+
+    for (long i = 0; i < psArrayLength(summitExps); i++) {
+        if (!summitExpInsertObject(config->dbh, summitExps->data[i])) {
+            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
+            return false;
         }
     }
 
-    // append '\0' to the end of the string
-    str[used + 1] = '\0';
-
-    return str;
+    psFree(summitExps);
 }
-*/
Index: /trunk/ippTools/src/pzgetexp.h
===================================================================
--- /trunk/ippTools/src/pzgetexp.h	(revision 6836)
+++ /trunk/ippTools/src/pzgetexp.h	(revision 6837)
@@ -4,5 +4,5 @@
 #include "pxtools.h"
 
-bool pzgetexpConfig(pxConfig *config, int argc, char **argv);
+pxConfig *pzgetexpConfig(pxConfig *config, int argc, char **argv);
 
 #endif // PZGETEXP_H
Index: /trunk/ippTools/src/pzgetexpConfig.c
===================================================================
--- /trunk/ippTools/src/pzgetexpConfig.c	(revision 6836)
+++ /trunk/ippTools/src/pzgetexpConfig.c	(revision 6837)
@@ -3,6 +3,8 @@
 #include "pxtools.h"
 
-bool pzgetexpConfig(pxConfig *config, int argc, char **argv) {
-    PS_ASSERT_PTR_NON_NULL(config, false);
+pxConfig *pzgetexpConfig(pxConfig *config, int argc, char **argv) {
+    if (!config) {
+        config = pxConfigAlloc();            
+    }
 
     if (! pmConfigRead(&config->site, &config->camera, &config->recipe, &argc, argv, RECIPE)) {
@@ -38,4 +40,4 @@
     config->dbh = pmConfigDB(config->site);
 
-    return true;
+    return config;
 } 
