Index: trunk/ppImage/src/ppImageConfig.c
===================================================================
--- trunk/ppImage/src/ppImageConfig.c	(revision 6747)
+++ trunk/ppImage/src/ppImageConfig.c	(revision 6817)
@@ -1,9 +1,17 @@
-#include <stdio.h>
-#include "pslib.h"
-#include "psmodules.h"
 #include "ppImage.h"
+
+static void usage (void) {
+    fprintf (stderr, "USAGE: ppImage [-file INPUT.fits] [-list INPUT.txt] OUTPUT\n");
+    exit (2);
+}
 
 pmConfig *ppImageConfig(int argc, char **argv)
 {
+
+    bool status;
+
+    if (argc == 1) usage ();
+
+    // load the site-wide configuration information
     pmConfig *config = pmConfigRead(&argc, argv);
     if (! config) {
@@ -12,25 +20,38 @@
     }
 
-    // Parse other command-line arguments
+    // Parse other command-line arguments, save for future use
     config->arguments = psMetadataAlloc(); // The arguments, with default values
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-key", 0, "exposure ID", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-bias", 0, "Name of the bias image", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-dark", 0, "Name of the dark image", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-flat", 0, "Name of the flat-field image", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-mask", 0, "Name of the mask image", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-fringe", 0, "Name of the fringe image", "");
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-chip", 0, "Chip number to process (if positive)", -1);
 
-    if (! psArgumentParse(config->arguments, &argc, argv) || argc != 3) {
-        printf("\nPan-STARRS Phase 2 processing\n\n");
-        printf("Usage: %s INPUT.fits OUTPUT.fits\n\n", argv[0]);
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
+    // if these command-line options are supplied, load the file name lists into config->arguments
+    // override any configuration-specified source for these files
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "BIAS", "-bias", "-biaslist");
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "DARK", "-dark", "-darklist");
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "FLAT", "-flat", "-flatlist");
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist");
+    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "FRINGE", "-fringe", "-fringelist");
+
+    // other command-line options
+    // XXX not sure how these are to be used at the moment
+    // psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-key", 0, "exposure ID", "");
+    // 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) {
+	usage ();
     }
 
     // Add the input and output images (which remain on the command-line) to the arguments list
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-input",  0, "Name of the input image",  argv[1]);
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[2]);
+    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");
+    }
 
     // Define database handle, if used
