Index: trunk/Ohana/src/opihi/dvo/Makefile
===================================================================
--- trunk/Ohana/src/opihi/dvo/Makefile	(revision 39601)
+++ trunk/Ohana/src/opihi/dvo/Makefile	(revision 39602)
@@ -48,4 +48,5 @@
 $(SRC)/catdir.$(ARCH).o             	\
 $(SRC)/catname.$(ARCH).o             	\
+$(SRC)/catid.$(ARCH).o             	\
 $(SRC)/cmatch.$(ARCH).o	  	\
 $(SRC)/cmpload.$(ARCH).o	  	\
Index: trunk/Ohana/src/opihi/dvo/catid.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/catid.c	(revision 39602)
+++ trunk/Ohana/src/opihi/dvo/catid.c	(revision 39602)
@@ -0,0 +1,71 @@
+# include "dvoshell.h"
+int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID);
+
+int catid (int argc, char **argv) {
+  
+  int N;
+
+  int ShowCoords = FALSE;
+  if ((N = get_argument (argc, argv, "-coords"))) {
+    remove_argument (N, &argc, argv);
+    ShowCoords = TRUE;
+  }
+  int ShowID = FALSE;
+  if ((N = get_argument (argc, argv, "-catid"))) {
+    remove_argument (N, &argc, argv);
+    ShowID = TRUE;
+  }
+  int ShowFile = FALSE;
+  if ((N = get_argument (argc, argv, "-file"))) {
+    remove_argument (N, &argc, argv);
+    ShowFile = TRUE;
+  }
+  int ShowHost = FALSE;
+  if ((N = get_argument (argc, argv, "-host"))) {
+    remove_argument (N, &argc, argv);
+    ShowHost = TRUE;
+  }
+  int ShowBackup = FALSE;
+  if ((N = get_argument (argc, argv, "-backup"))) {
+    remove_argument (N, &argc, argv);
+    ShowBackup = TRUE;
+  }
+  int ShowFlags = FALSE;
+  if ((N = get_argument (argc, argv, "-flags"))) {
+    remove_argument (N, &argc, argv);
+    ShowFlags = TRUE;
+  }
+
+  if (argc != 2) {
+    gprint (GP_ERR, "USAGE: catid (catID) [-host] [-backup] [-flags] [-file] [-coords] [-catid]\n");
+    return (FALSE);
+  }
+
+  /* load sky from correct table */
+  char *CATDIR = GetCATDIR();
+  if (!CATDIR) {
+    gprint (GP_ERR, "CATDIR is not set\n");
+    return FALSE;
+  }
+  SkyTable *sky = GetSkyTable ();
+  if (!sky) {
+    gprint (GP_ERR, "failed to load sky table for database\n");
+    return FALSE;
+  }
+  HostTable *table = NULL;
+  if (HostTableExists (CATDIR, sky->hosts)) {
+    table = HostTableLoad (CATDIR, sky->hosts);
+    if (!table) {
+      gprint (GP_ERR, "ERROR: failure reading Host Table %s for parallel database %s\n", sky->hosts, CATDIR);
+      return FALSE;
+    }    
+  }
+
+  int catID = atoi (argv[1]);
+  SkyList *skylist = SkyRegionByIndex (sky, catID);
+
+  gcat_listnames (skylist, table, ShowFile, ShowHost, ShowBackup, ShowFlags, ShowCoords, ShowID);
+  SkyListFree (skylist);
+
+  return (TRUE);
+}
Index: trunk/Ohana/src/opihi/dvo/catname.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/catname.c	(revision 39601)
+++ trunk/Ohana/src/opihi/dvo/catname.c	(revision 39602)
@@ -1,9 +1,24 @@
 # include "dvoshell.h"
+int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID);
 
 int catname (int argc, char **argv) {
   
-  int i, N;
-  struct stat filestat;
+  int N;
 
+  int ShowCoords = FALSE;
+  if ((N = get_argument (argc, argv, "-coords"))) {
+    remove_argument (N, &argc, argv);
+    ShowCoords = TRUE;
+  }
+  int ShowID = FALSE;
+  if ((N = get_argument (argc, argv, "-catid"))) {
+    remove_argument (N, &argc, argv);
+    ShowID = TRUE;
+  }
+  int ShowFile = FALSE;
+  if ((N = get_argument (argc, argv, "-file"))) {
+    remove_argument (N, &argc, argv);
+    ShowFile = TRUE;
+  }
   int ShowHost = FALSE;
   if ((N = get_argument (argc, argv, "-host"))) {
@@ -16,9 +31,4 @@
     ShowBackup = TRUE;
   }
-  int FullName = FALSE;
-  if ((N = get_argument (argc, argv, "-full-name"))) {
-    remove_argument (N, &argc, argv);
-    FullName = TRUE;
-  }
   int ShowFlags = FALSE;
   if ((N = get_argument (argc, argv, "-flags"))) {
@@ -26,15 +36,11 @@
     ShowFlags = TRUE;
   }
-  int PARALLEL = FALSE;
-  if ((N = get_argument (argc, argv, "-parallel"))) {
-    remove_argument (N, &argc, argv);
-    PARALLEL = TRUE;
-  }
 
   if (argc != 2) {
-    gprint (GP_ERR, "USAGE: catname name [-host] [-backup] [-flags]\n");
+    gprint (GP_ERR, "USAGE: catname name [-host] [-backup] [-flags] [-file] [-coords] [-catid]\n");
     return (FALSE);
   }
 
+  /* load sky from correct table */
   char *CATDIR = GetCATDIR();
   if (!CATDIR) {
@@ -47,58 +53,18 @@
     return FALSE;
   }
-  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
-  if (!table) {
-    gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
-    return FALSE;
-  }    
+  HostTable *table = NULL;  
+  if (HostTableExists (CATDIR, sky->hosts)) {
+    table = HostTableLoad (CATDIR, sky->hosts);
+    if (!table) {
+      gprint (GP_ERR, "ERROR: failure reading Host Table %s for parallel database %s\n", sky->hosts, CATDIR);
+      return FALSE;
+    }    
+  }
+
   SkyList *skylist = SkyListByName (sky, argv[1]);
 
-  // prepare to handle interrupt signals
-  struct sigaction *old_sigaction = SetInterrupt();
-
-  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
-    char *filename = NULL;
-    if (PARALLEL) {
-      SkyRegion *region = skylist[0].regions[i];
-      int hostID = (region->hostFlags & DATA_USE_BCK) ? region->backupID : region->hostID;
-      int index = table->index[hostID];
-    
-      char hostfile[1024];
-      snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, region->name);
-      filename = hostfile;
-    } else {
-      filename = skylist[0].filename[i];
-    }
-
-    gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name);
-    if (stat (filename, &filestat) != -1) {
-      gprint (GP_ERR, " +");
-    } else {
-      gprint (GP_ERR, " -");
-    } 
-    if (ShowHost) {
-      gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].hostID);
-    } else {
-      gprint (GP_ERR, "     ");
-    }
-    if (FullName) {
-      gprint (GP_ERR, "  %s", filename);
-    }
-    if (ShowBackup) {
-      gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].backupID);
-    } else {
-      gprint (GP_ERR, "     ");
-    }
-    if (ShowFlags) {
-      gprint (GP_ERR, "  0x%04x", skylist[0].regions[i][0].hostFlags);
-    } else {
-      gprint (GP_ERR, "        ");
-    }
-    gprint (GP_ERR, "\n");
-    set_str_variable ("CATNAME", filename);
-  }
-  ClearInterrupt (old_sigaction);
+  gcat_listnames (skylist, table, ShowFile, ShowHost, ShowBackup, ShowFlags, ShowCoords, ShowID);
+  SkyListFree (skylist);
 
   return (TRUE);
-  SkyListFree (skylist);
 }
Index: trunk/Ohana/src/opihi/dvo/gcat.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/gcat.c	(revision 39601)
+++ trunk/Ohana/src/opihi/dvo/gcat.c	(revision 39602)
@@ -1,12 +1,19 @@
 # include "dvoshell.h"
+int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID);
 
 int gcat (int argc, char **argv) {
   
-  int i, N;
-  struct stat filestat;
-  double Ra, Dec, Radius;
-  SkyTable *sky;
-  SkyList *skylist;
+  int N;
 
+  int ShowCoords = FALSE;
+  if ((N = get_argument (argc, argv, "-coords"))) {
+    remove_argument (N, &argc, argv);
+    ShowCoords = TRUE;
+  }
+  int ShowID = FALSE;
+  if ((N = get_argument (argc, argv, "-catid"))) {
+    remove_argument (N, &argc, argv);
+    ShowID = TRUE;
+  }
   int ShowFile = FALSE;
   if ((N = get_argument (argc, argv, "-file"))) {
@@ -31,21 +38,20 @@
 
   if ((argc != 3) && (argc != 4)) {
-    gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] [-host] [-backup] [-flags]\n");
+    gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] [-host] [-backup] [-flags] [-file] [-coords] [-catid]\n");
     return (FALSE);
   }
 
   /* load sky from correct table */
-  Ra = atof (argv[1]);
-  Dec = atof (argv[2]);
-  if (argc == 4) 
-    Radius = atof(argv[3]);
-  else 
-    Radius = 0.0001;
-
-  sky = GetSkyTable ();
-  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
-
+  char *CATDIR = GetCATDIR();
+  if (!CATDIR) {
+    gprint (GP_ERR, "CATDIR is not set\n");
+    return FALSE;
+  }
+  SkyTable *sky = GetSkyTable ();
+  if (!sky) {
+    gprint (GP_ERR, "failed to load sky table for database\n");
+    return FALSE;
+  }
   HostTable *table = NULL;  
-  char *CATDIR = GetCATDIR();
   if (HostTableExists (CATDIR, sky->hosts)) {
     table = HostTableLoad (CATDIR, sky->hosts);
@@ -55,4 +61,21 @@
     }    
   }
+
+  double Ra = atof (argv[1]);
+  double Dec = atof (argv[2]);
+  double Radius = (argc == 4) ? atof(argv[3]) : 0.0001;
+
+  SkyList *skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
+
+  gcat_listnames (skylist, table, ShowFile, ShowHost, ShowBackup, ShowFlags, ShowCoords, ShowID);
+  SkyListFree (skylist);
+
+  return (TRUE);
+}
+
+int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID) {
+
+  int i;
+  struct stat filestat;
 
   // prepare to handle interrupt signals
@@ -77,9 +100,20 @@
     }
 
+    if (ShowCoords) {
+      gprint (GP_ERR, " %7.3f %7.3f : %7.3f %7.3f", region->Rmin, region->Rmax, region->Dmin, region->Dmax);
+    } else {
+      gprint (GP_ERR, " %33s", " ");
+    }
+
     if (stat (hostfile, &filestat) != -1) {
-      gprint (GP_ERR, " *");
+      gprint (GP_ERR, " +");
     } else {
-      gprint (GP_ERR, "  ");
+      gprint (GP_ERR, " -");
     } 
+    if (ShowID) {
+      gprint (GP_ERR, " %5d", region->index);
+    } else {
+      gprint (GP_ERR, "%6s", " ");
+    }
     if (ShowHost) {
       gprint (GP_ERR, "  %3d", region->hostID);
@@ -100,7 +134,6 @@
     set_str_variable ("CATNAME", hostfile);
   }
+
   ClearInterrupt (old_sigaction);
-
   return (TRUE);
-  SkyListFree (skylist);
 }
Index: trunk/Ohana/src/opihi/dvo/init.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/init.c	(revision 39601)
+++ trunk/Ohana/src/opihi/dvo/init.c	(revision 39602)
@@ -8,4 +8,5 @@
 int catlog          PROTO((int, char **));
 int catname         PROTO((int, char **));
+int catid           PROTO((int, char **));
 int catdir_define   PROTO((int, char **));
 int ccd             PROTO((int, char **));
@@ -70,4 +71,5 @@
 //  {1, "calmextract", calmextract,  "extract photometry calibration"},
   {1, "catname",     catname,      "list catalog files by name"},
+  {1, "catid",       catid,        "list catalog files by catID"},
   {1, "catdir",      catdir_define,"re-define CATDIR"},
 //  {1, "ccd",         ccd,          "plot color-color diagram"},
