Index: trunk/Ohana/src/opihi/dvo/cmd.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/cmd.c	(revision 5320)
+++ trunk/Ohana/src/opihi/dvo/cmd.c	(revision 5451)
@@ -3,17 +3,16 @@
 int cmd (int argc, char **argv) { /* really need to think about upper limits & how to represent them */
   
-  char filename[256], catdir[256], *RegionName, *RegionList;
+  char *RegionName, *RegionList;
   double *M1, *M3;
   int i, j, m, i1, i3, N1, N3, N;
   int Npts, NPTS, mode[3];
-  int Nsec, Nregions, KeepNulls;
+  int Nsec, KeepNulls;
 
+  PhotCode *code[3];
   Catalog catalog;
-  RegionFile *regions;
-  PhotCode *code[3];
+  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 */
@@ -49,5 +45,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 */
@@ -58,8 +54,7 @@
 
   /* loop over regions, extract data for each region */
-  for (j = 0; j < Nregions; j++) {
+  for (j = 0; j < skylist[0].Nregions; j++) {
     /* lock, load, unlock catalog */
-    sprintf (filename, "%s/%s", catdir, regions[j].name);
-    catalog.filename = filename;
+    catalog.filename = (char *) skylist[0].regions[j][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
@@ -119,5 +114,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);
@@ -128,5 +123,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);
