Index: trunk/ppMerge/src/ppMergeParseCamera.c
===================================================================
--- trunk/ppMerge/src/ppMergeParseCamera.c	(revision 5860)
+++ trunk/ppMerge/src/ppMergeParseCamera.c	(revision 5862)
@@ -38,6 +38,6 @@
 	    ppFPA *fpa = ppFPA_Alloc ();
 	    fpa->filename = psStringCopy (globList.gl_pathv[i]);
+	    psArrayAdd (input, 100, fpa);
 	}
-	psArrayAdd (input, 100, fpa);
     }
 
@@ -56,6 +56,6 @@
 	}
 	while (fgets (line, 1024, f) != NULL) {
-	    nItems = fscanf (f, "%s %lf %lf", filename, &zero, &scale);
-	    fpa = ppFPA_Alloc ();
+	    nItems = sscanf (line, "%s %lf %lf", filename, &zero, &scale);
+	    ppFPA *fpa = ppFPA_Alloc ();
 	    switch (nItems) {
 	      case 0:
@@ -65,5 +65,7 @@
 		fpa->zero  = zero;
 		fpa->scale = scale;
-		// NOTE: continues to case 1 below
+		fpa->filename = psStringCopy (filename);
+		psArrayAdd (input, 100, fpa);
+		break;
 	      case 1:
 		fpa->filename = psStringCopy (filename);
@@ -85,8 +87,10 @@
 
     // Open the input images, test that they are the same camera
-    psLogMsg("phase2", PS_LOG_INFO, "Opening input images\n");
+    psLogMsg("merge", PS_LOG_INFO, "Opening input images\n");
     for (int i = 0; i < input->n; i++) {
 	
 	ppFPA *fpa = input->data[i];
+
+	psLogMsg("merge", PS_LOG_INFO, "Trying %s...\n", fpa->filename);
 
 	fpa->fits = psFitsOpen(fpa->filename, "r"); // File handle for FITS file
@@ -130,5 +134,6 @@
 
     // data->process acts as a process mask for the full FPA
-    data->process = pmFPAConstruct(config->camera);
+    data->process = ppFPA_Alloc ();
+    data->process->fpa = pmFPAConstruct(config->camera);
 
     // see if we have selected a specific chip
@@ -144,5 +149,15 @@
     // data->mask carries a pixel mask for pixels to be ignored
     // the name and contents of the mask are determined in ppMergeOptions
-    data->mask = pmFPAConstruct(config->camera);
+    data->mask = ppFPA_Alloc ();
+    data->mask->fpa = pmFPAConstruct(config->camera);
+
+    // data->output will store the output file
+    // currently, we keep the complete output file and write it at the end
+    data->output = ppFPA_Alloc ();
+    data->output->fpa = pmFPAConstruct(config->camera);
+    data->output->filename = psMetadataLookupPtr (NULL, config->arguments, "-output");
+    if (! *data->output->filename) {
+	psAbort ("merge", "output file not specified");
+    }
 
     return true;
