Index: /trunk/Ohana/src/addstar/src/ConfigInit.c
===================================================================
--- /trunk/Ohana/src/addstar/src/ConfigInit.c	(revision 8427)
+++ /trunk/Ohana/src/addstar/src/ConfigInit.c	(revision 8428)
@@ -1,3 +1,5 @@
 # include "addstar.h"
+
+void GetConfig (char *config, char *field, char *format, int N, void *ptr);
 
 AddstarClientOptions ConfigInit (int *argc, char **argv) {
@@ -18,16 +20,28 @@
   if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
 
-  XMIN = XMAX = YMIN = YMAX = 0;
 
-  /* used by client to interpret input data */
+  /* exclude overscan region from the dB image boundaries */
+  XOVERSCAN = YOVERSCAN = 0;
   ScanConfig (config, "XOVERSCAN",              "%d",  0, &XOVERSCAN);
   ScanConfig (config, "YOVERSCAN",              "%d",  0, &YOVERSCAN);
+
+  /* only upload stars within region; a value of 0 means ignore the limit */
+  XMIN = XMAX = YMIN = YMAX = 0;
   ScanConfig (config, "ADDSTAR_XMIN",           "%d",  0, &XMIN);
   ScanConfig (config, "ADDSTAR_XMAX",           "%d",  0, &XMAX);
   ScanConfig (config, "ADDSTAR_YMIN",           "%d",  0, &YMIN);
   ScanConfig (config, "ADDSTAR_YMAX",           "%d",  0, &YMAX);
+
+  /* exclude stars with SN > SNLIMIT (ADDSTAR_SNLIMIT overrides old name MIN_SN_FSTAT) */
+  SNLIMIT = 0;
   ScanConfig (config, "MIN_SN_FSTAT",           "%lf", 0, &SNLIMIT);
+  ScanConfig (config, "ADDSTAR_SNLIMIT",        "%lf", 0, &SNLIMIT);
 
   /* used by parse_time to find time-related keywords */
+  strcpy (DateKeyword, "NONE");
+  strcpy (DateMode, "NONE");
+  strcpy (UTKeyword, "NONE");
+  strcpy (JDKeyword, "NONE");
+  strcpy (MJDKeyword, "NONE");
   ScanConfig (config, "DATE-KEYWORD",           "%s",  0, DateKeyword);
   ScanConfig (config, "DATE-MODE",              "%s",  0, DateMode);
@@ -39,5 +53,4 @@
   ScanConfig (config, "AIRMASS-KEYWORD",        "%s",  0, AirmassKeyword);
   ScanConfig (config, "CCDNUM-KEYWORD",         "%s",  0, CCDNumKeyword);
-
   ScanConfig (config, "ST-KEYWORD",             "%s",  0, STKeyword);
   ScanConfig (config, "OBSERVATORY-LATITUDE",   "%lf", 0, &Latitude);
@@ -45,6 +58,8 @@
 
   /* instrumental magnitude range for calibration mode */
-  if (!ScanConfig (config, "CAL_INSTMAG_MAX",   "%lf", 0, &CAL_INSTMAG_MAX)) CAL_INSTMAG_MAX =  -9.0;
-  if (!ScanConfig (config, "CAL_INSTMAG_MIN",   "%lf", 0, &CAL_INSTMAG_MIN)) CAL_INSTMAG_MIN = -13.0;
+  CAL_INSTMAG_MAX =  -9.0;
+  CAL_INSTMAG_MIN = -13.0;
+  ScanConfig (config, "CAL_INSTMAG_MAX",   "%lf", 0, &CAL_INSTMAG_MAX);
+  ScanConfig (config, "CAL_INSTMAG_MIN",   "%lf", 0, &CAL_INSTMAG_MIN);
 
   /* location of needed data sources */
@@ -60,11 +75,11 @@
   ScanConfig (config, "TYCHO_DIR",             "%s",  0, TYCHO_DIR);
 
-  ScanConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
-  ScanConfig (config, "CATDIR",                 "%s",  0, CATDIR);
+  GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
+  GetConfig (config, "CATDIR",                 "%s",  0, CATDIR);
+  GetConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
   ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
   ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
-  ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
   if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
-    SKY_DEPTH = 2;
+    SKY_DEPTH = 3;
   }
   if (!ScanConfig (config, "SKY_TABLE",         "%s",  0, SKY_TABLE)) {
@@ -73,5 +88,5 @@
   sprintf (ImageCat, "%s/Images.dat", CATDIR);
 
-  /* dropped: ScanConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat); */
+  /* dropped: GetConfig (config, "IMAGE_CATALOG",          "%s",  0, ImageCat); */
 
   ScanConfig (config, "CAMERA_LAYOUT",          "%s",  0, CameraLayout);
@@ -114,8 +129,13 @@
 
   /* set the default search radius */
-  ScanConfig (config, "RADIUS",                 "%s",  0, RadiusWord);
-  ScanConfig (config, "NSIGMA",                 "%lf", 0, &options.Nsigma);
+  if (!ScanConfig (config, "ADDSTAR_RADIUS", "%s", 0, RadiusWord)) {
+    GetConfig (config, "RADIUS", "%s", 0, RadiusWord);
+  }
+  /* XXX this does not work for refcat and reflist modes... */
   if (!strcasecmp (RadiusWord, "header")) {
     options.radius = 0;
+    if (!ScanConfig (config, "ADDSTAR_NSIGMA", "%lf", 0, &options.Nsigma)) {
+      GetConfig (config, "NSIGMA", "%lf", 0, &options.Nsigma);
+    }
   } else {
     options.radius = atof (RadiusWord);
Index: /trunk/Ohana/src/addstar/src/gstars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/gstars.c	(revision 8427)
+++ /trunk/Ohana/src/addstar/src/gstars.c	(revision 8428)
@@ -10,4 +10,6 @@
   Stars *stars, *rdstars;
   Header header;
+
+  /* XXX which of these values are required, which are just interesting? */
 
   if (!gfits_read_header (file, &header)) {
@@ -202,5 +204,5 @@
   for (N = j = 0; j < image[0].nstar; j++) {
     /* allow for some dynamic filtering of star list */
-    if (rdstars[j].dM > SNLIMIT) continue;
+    if (SNLIMIT && rdstars[j].dM > SNLIMIT) continue;
     if (XMAX && (rdstars[j].X > XMAX)) continue;
     if (XMIN && (rdstars[j].X < XMIN)) continue;
Index: /trunk/Ohana/src/addstar/src/parse_time.c
===================================================================
--- /trunk/Ohana/src/addstar/src/parse_time.c	(revision 8427)
+++ /trunk/Ohana/src/addstar/src/parse_time.c	(revision 8428)
@@ -27,4 +27,17 @@
   }
     
+  if (!strcasecmp (UTKeyword, "NONE")) {
+      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
+      exit (1);
+  }
+  if (!strcasecmp (DateKeyword, "NONE")) {
+      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
+      exit (1);
+  }
+  if (!strcasecmp (DateMode, "NONE")) {
+      fprintf (stderr, "ERROR: no valid Date/Time keywords\n");
+      exit (1);
+  }
+
   /* get UT and DATE */
   uppercase (UTKeyword);
