Index: trunk/Ohana/src/opihi/dvo/ccd.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/ccd.c	(revision 5320)
+++ trunk/Ohana/src/opihi/dvo/ccd.c	(revision 5451)
@@ -3,17 +3,16 @@
 int ccd (int argc, char **argv) {
   
-  char filename[256], catdir[256], *RegionName, *RegionList;
+  char *RegionName, *RegionList;
   double *M1, *M2;
   int i, m, k, Npts, NPTS, N;
   int N1, N2, i1, i2, mode[4];
-  int Nsec, Nregions, KeepNulls;
+  int Nsec, KeepNulls;
 
   Catalog catalog;
-  RegionFile *regions;
   PhotCode *code[4];
+  SkyList *skylist;
   Vector *xvec, *yvec;
 
   /* defaults */
-  regions = NULL;
   catalog.average = NULL; 
   catalog.secfilt = NULL;
@@ -25,7 +24,4 @@
   if (!InitPhotcodes ()) goto escape;
   Nsec = GetPhotcodeNsecfilt ();
-
-  /* find CATDIR in config system */
-  if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;
 
   /* interpret command-line options */
@@ -51,5 +47,5 @@
 
   /* load region corresponding to selection above */
-  if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;
+  if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape;
 
   /* init vectors to save data */
@@ -60,8 +56,7 @@
 
   /* loop over regions, extract data for each region */
-  for (k = 0; k < Nregions; k++) {
+  for (k = 0; k < skylist[0].Nregions; k++) {
     /* lock, load, unlock catalog */
-    sprintf (filename, "%s/%s", catdir, regions[k].name);
-    catalog.filename = filename;
+    catalog.filename = (char *) skylist[0].regions[k][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
       case 2:
@@ -121,5 +116,5 @@
     catalog.measure = (Measure *) NULL;
   }
-  if (regions != NULL) free (regions);
+  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
   xvec[0].Nelements = yvec[0].Nelements = Npts;
   return (TRUE);
@@ -130,5 +125,5 @@
 
 escape:
-  if (regions != NULL) free (regions);
+  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
   if (catalog.average != NULL) free (catalog.average);
   if (catalog.secfilt != NULL) free (catalog.secfilt);
