Index: trunk/Ohana/src/opihi/dvo/avextract.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/avextract.c	(revision 5320)
+++ trunk/Ohana/src/opihi/dvo/avextract.c	(revision 5451)
@@ -4,14 +4,13 @@
   
   int i, j, m, N, NPTS, param;
-  int Nsec, Nregions, mode;
-  char filename[256], catdir[256], *RegionName, *RegionList, *p;
+  int Nsec, mode;
+  char *RegionName, *RegionList, *p;
 
   Catalog catalog;
-  RegionFile *regions;
+  SkyList *skylist;
   PhotCode *code;
   Vector *vec;
 
   /* 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 */
@@ -50,5 +46,5 @@
 
   /* load region corresponding to selection above */
-  if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;
+  if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape;
 
   /* create storage vector */
@@ -57,8 +53,7 @@
   if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape;
 
-  for (i = 0; i < Nregions; i++) {
+  for (i = 0; i < skylist[0].Nregions; i++) {
     /* lock, load, unlock catalog */
-    sprintf (filename, "%s/%s", catdir, regions[i].name);
-    catalog.filename = filename;
+    catalog.filename = (char *) skylist[0].regions[i][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
@@ -90,5 +85,5 @@
   REALLOCATE (vec[0].elements, float, MAX(1,N));
 
-  if (regions != NULL) free (regions);
+  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
   return (TRUE);
 
@@ -98,5 +93,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);
