Index: trunk/ppMerge/src/ppMergeConfig.c
===================================================================
--- trunk/ppMerge/src/ppMergeConfig.c	(revision 5862)
+++ trunk/ppMerge/src/ppMergeConfig.c	(revision 6824)
@@ -1,11 +1,18 @@
 # include "ppMerge.h"
 
-bool ppMergeConfig (ppConfig *config, int argc, char **argv) {
+static void usage (void) {
+    fprintf (stderr, "USAGE: ppMerge [-file INPUT.fits] [-list INPUT.txt] OUTPUT\n");
+    exit (2);
+}
 
-    // Parse the configurations (re-org a la ppImage)
-    config->site = NULL;            // Site configuration
-    config->camera = NULL;          // Camera configuration
-    config->recipe = NULL;          // Recipe configuration
-    if (! pmConfigRead(&config->site, &config->camera, &config->recipe, &argc, argv, RECIPE)) {
+pmConfig *ppMergeConfig (int argc, char **argv)
+{
+    bool status;
+
+    if (argc == 1) usage ();
+
+    // load the site-wide configuration information
+    pmConfig *config = pmConfigRead(&argc, argv);
+    if (! config) {
         psErrorStackPrint(stderr, "Can't find site configuration!\n");
         exit(EXIT_FAILURE);
@@ -15,43 +22,32 @@
     config->arguments = psMetadataAlloc(); // The arguments, with default values
 
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-glob",  0, "Load files based on a filename glob (eg, file0??.fits)", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-text",  0, "Load files from a text list", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-xml",   0, "Load files from an xml-format file", "");
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-zero",  0, "Name of the mask image", 0);
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-scale", 0, "Chip number to process (if positive)", 1);
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-chip",  0, "Chip number to process (if positive)",-1);
+    // the input file is a required argument; if not found, we will exit
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
+    if (!status) { usage ();}
 
     if (! psArgumentParse(config->arguments, &argc, argv) || argc != 2) {
-        printf("\nPan-STARRS Phase 2 processing\n\n");
-        printf("Usage: %s OUTPUT.fits\n\n", argv[0]);
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
+	usage ();
     }
 
-    // add the input and output images to the arguments list
-    psMetadataAddStr (config->arguments, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[1]);
+    // Add the input and output images (which remain on the command-line) to the arguments list
+    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
 
+    // the input image(s) are required arguments
+    // the first one defines the camera
+    status = false;
+    pmFPAfileFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT");
+    if (!status) {
+	psAbort (__func__, "missing INPUT entry");
+    }
+
+# if 0
     // define Database handle, if used
     config->database = pmConfigDB(config->site);
+# endif
+
     return true;
 } 
 
-/*
-
-  possible invokations:
-  ppMerge -glob (glob) (output)
-  ppMerge -text (textfile) (output)
-  ppMerge -xml (xmlfile) (output)
-  options:
-    -zero zero
-    -scale scale
-  
-  - input is (in some form) a list of files to be merged
-  * each chip / cell may have a different bzero / bscale specified
-  * a simple glob list implies bzero / bscale are constant for all
-  * the textfile format consists of: (file) [zero scale]
-  * the xmlfile format includes zero,scale values for each cell
-  
+/* we require all information needed to determine the scaling 
+   to be written in the header.  is this reasonable? 
 */
-
