Index: trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- trunk/Ohana/src/libdvo/include/dvo.h	(revision 39293)
+++ trunk/Ohana/src/libdvo/include/dvo.h	(revision 39301)
@@ -1071,4 +1071,5 @@
 SkyTable  *SkyTableLoadOptimal 	   PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE));
 int        SkyTableSetDepth    	   PROTO((SkyTable *sky, int depth));
+SkyList   *SkyListMatchList        PROTO((SkyList *inlist, char **cptlist, int Ncptlist));
 SkyList   *SkyRegionByIndex        PROTO((SkyTable *table, int index));
 SkyList   *SkyRegionByCPT          PROTO((SkyTable *table, char *filename));
Index: trunk/Ohana/src/libdvo/src/skyregion_ops.c
===================================================================
--- trunk/Ohana/src/libdvo/src/skyregion_ops.c	(revision 39293)
+++ trunk/Ohana/src/libdvo/src/skyregion_ops.c	(revision 39301)
@@ -154,4 +154,46 @@
     }
   }
+  list[0].Nregions = N;
+  return (list);
+}
+
+/* find regions at all levels which match list of names */
+SkyList *SkyListMatchList (SkyList *inlist, char **cptlist, int Ncptlist) {
+
+  int i, j;
+  SkyList *list;
+  
+  int N = 0;
+  int NREGIONS = 10;
+  ALLOCATE (list, SkyList, 1);
+  ALLOCATE (list[0].regions, SkyRegion *, NREGIONS);
+  ALLOCATE (list[0].filename, char *, NREGIONS);
+  list[0].Nregions = N;
+  list[0].ownElements = FALSE; // this list is only holding a view to the elements
+  strcpy (list[0].hosts, inlist[0].hosts);
+
+  SkyRegion **regions = inlist[0].regions;
+
+  for (i = 0; i < inlist[0].Nregions; i++) {
+    int found = FALSE;
+    for (j = 0; !found && (j < Ncptlist); j++) {
+      int Nchar = strlen (cptlist[j]);
+      if (strncasecmp (regions[i][0].name, cptlist[j], Nchar)) continue;
+
+      list[0].regions[N] = regions[i];
+      list[0].filename[N] = inlist[0].filename[i];
+      N++;
+      if (N >= NREGIONS) {
+	NREGIONS += 10;
+	REALLOCATE (list[0].regions, SkyRegion *, NREGIONS);
+	REALLOCATE (list[0].filename, char *, NREGIONS);
+      }
+      found = TRUE;
+    }
+    // we do not care if one of the regions does not match.  do we care if any of the
+    // cptfile do not match?
+  }
+  SkyListFree (inlist);
+
   list[0].Nregions = N;
   return (list);
