Index: trunk/stac/src/stacConfig.c
===================================================================
--- trunk/stac/src/stacConfig.c	(revision 3387)
+++ trunk/stac/src/stacConfig.c	(revision 3610)
@@ -9,5 +9,5 @@
 {
     fprintf (stderr, "STAC: Simultaneous Telescope Array Combination\n"
-	     "Usage: %s [-h] [-v] [-g GAIN] [-r RN] [-o NX NY] [-s SAT] [-b BAD] [-k REJ] [-n NREJECT] [-k FRAC] [-G GRAD] OUT IN1 IN2...\n"
+	     "Usage: %s [-h] [-v] [-g GAIN] [-r RN] [-o NX NY] [-S] [-s SAT] [-b BAD] [-p FILE MAP] [-a APER] [-k REJ] [-n NREJECT] [-k FRAC] [-G GRAD] OUT IN1 IN2...\n"
 	     "where\n"
 	     "\t-h           Help (this info)\n"
@@ -16,6 +16,9 @@
 	     "\t-r           Read noise (e) for detectors\n"
 	     "\t-o NX NY     Size of output image (512, 512)\n"
-	     "\t-s SAT       Saturation level (65536)\n"
+	     "\t-S           Save shifted images (false)\n"
+	     "\t-s SAT       Saturation level (65535)\n"
 	     "\t-b BAD       Bad level (0)\n"
+	     "\t-p FILE MAP  Specify file containing star coordinates, with map\n"
+	     "\t-a APER      Aperture size to use for photometry (3 pix)\n"
 	     "\t-k REJ       Rejection level (k-sigma; 3.5)\n"
 	     "\t-n NREJECT   Number of rejection iterations (2)\n"
@@ -39,8 +42,12 @@
     config->inputs = NULL;
     config->output = NULL;
+    config->saveShifts = false;
+    config->starFile = NULL;
+    config->starMapFile = NULL;
+    config->aper = 3.0;
     config->outnx = 512;
     config->outny = 512;
-    config->saturated = 65535.0;
-    config->bad = 0.0;
+    config->saturated = NULL;		// Saturations; will fill this in later, when we know how many images
+    config->bad = NULL;			// Bad levels; will fill this in later, when we know how many images
     config->reject = 3.0;
     config->frac = 0.5;
@@ -54,7 +61,13 @@
 void stacConfigFree(stacConfig *config)
 {
-    // Free the vector, if necessary
+    // Free the vectors, if necessary
     if (config->inputs) {
 	psFree(config->inputs);
+    }
+    if (config->saturated) {
+	psFree(config->saturated);
+    }
+    if (config->bad) {
+	psFree(config->bad);
     }
     // Free everything
@@ -69,4 +82,7 @@
     stacConfig *config = stacConfigAlloc(); // Configuration values
     const char *programName = argv[0];	// Program name
+
+    float saturated = 65535.0;		// Saturation level
+    float bad = 0.0;			// Bad level
 
     /* Variables for getopt */
@@ -76,5 +92,5 @@
 
     /* Parse command-line arguments using getopt */
-    while ((opt = getopt(argc, argv, "hvg:r:o:s:b:k:n:f:G:")) != -1) {
+    while ((opt = getopt(argc, argv, "hvSg:r:o:s:b:k:n:f:G:p:a:")) != -1) {
         switch (opt) {
 	  case 'h':
@@ -87,4 +103,5 @@
 	    if (sscanf(optarg, "%f", &config->gain) != 1) {
 		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -92,4 +109,5 @@
 	    if (sscanf(optarg, "%f", &config->readnoise) != 1) {
 		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -97,8 +115,5 @@
             if ((sscanf(argv[optind-1], "%d", &config->outnx) != 1) ||
                 (sscanf(argv[optind++], "%d", &config->outny) != 1)) {
-                /*
-                  Note: incrementing optind, so I can read more than
-                  one parameter.
-                */
+                // Note: incrementing optind, so I can read more than one parameter.
                 help(programName);
                 exit(EXIT_FAILURE);
@@ -106,11 +121,28 @@
 	    break;
 	  case 's':
-	    if (sscanf(optarg, "%f", &config->saturated) != 1) {
-		help(programName);
+	    if (sscanf(optarg, "%f", &saturated) != 1) {
+		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
 	  case 'b':
-	    if (sscanf(optarg, "%f", &config->bad) != 1) {
-		help(programName);
+	    if (sscanf(optarg, "%f", &bad) != 1) {
+		help(programName);
+		exit(EXIT_FAILURE);
+	    }
+	    break;
+	  case 'p':
+	    if (argc < optind+1) {
+		help(programName);
+		exit(EXIT_FAILURE);
+	    }
+	    config->starFile = argv[optind-1];
+	    config->starMapFile = argv[optind++];
+	    // Note: incrementing optind, so I can read more than one parameter.
+	    break;
+	  case 'a':
+	    if (sscanf(optarg, "%f", &config->aper) != 1) {
+		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -118,4 +150,5 @@
 	    if (sscanf(optarg, "%f", &config->reject) != 1) {
 		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -123,4 +156,5 @@
 	    if (sscanf(optarg, "%d", &config->nReject) != 1) {
 		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -128,4 +162,5 @@
 	    if (sscanf(optarg, "%f", &config->frac) != 1) {
 		help(programName);
+		exit(EXIT_FAILURE);
 	    }
 	    break;
@@ -133,5 +168,9 @@
 	    if (sscanf(optarg, "%f", &config->grad) != 1) {
 		help(programName);
-	    }
+		exit(EXIT_FAILURE);
+	    }
+	    break;
+	  case 'S':
+	    config->saveShifts = true;
 	    break;
 	  default:
@@ -156,4 +195,12 @@
     }
 
+    // Create the saturation and bad vectors
+    config->saturated = psVectorAlloc(argc-1, PS_TYPE_F32);
+    config->bad = psVectorAlloc(argc-1, PS_TYPE_F32);
+    for (int i = 0; i < argc - 1; i++) {
+	((psVector*)config->saturated)->data.F32[i] = saturated;
+	((psVector*)config->bad)->data.F32[i] = bad;
+    }
+
     // Debugging output
     psTrace("stac.config", 8, "Parsed command line for configuration\n");
