Index: trunk/Ohana/src/opihi/dvo/skycat.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/skycat.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/skycat.c	(revision 5451)
@@ -1,3 +1,5 @@
 # include "dvo1.h"
+
+int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside);
 
 int skycat (int argc, char **argv) {
@@ -5,17 +7,12 @@
   double Radius;
   int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, TableDepth;
-  char filename[128];
   struct stat filestat;
   Vector Xvec, Yvec;
   Graphdata graphmode;
   double X[4], Y[4], Rmin, Rmax, Rmid;
-  char catdir[256], gscfile[256];
   int Ngraph, VERBOSE;
   SkyTable *sky;
   SkyList *skylist;
   SkyRegion **regions;
-
-  VarConfig ("CATDIR", "%s", catdir);
-  VarConfig ("GSCFILE", "%s", gscfile);
 
   VERBOSE = FALSE;
@@ -45,6 +42,6 @@
 
   Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
-  sky = SkyTableFromGSC (gscfile, TableDepth, VERBOSE);
-  if (sky == NULL) return (FALSE);
+
+  sky = GetSkyTable ();
   skylist = SkyListByRadius (sky, Depth, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
   
@@ -66,6 +63,5 @@
 
   for (i = 0; i < Nregions; i++) {
-    sprintf (filename, "%s/%s", catdir, regions[i][0].name);
-    if (ShowAll || (stat (filename, &filestat) != -1)) {
+    if (ShowAll || (stat ((char *) regions[i][0].filename, &filestat) != -1)) {
       if (VERBOSE) fprintf (stderr, "%3d %s %6.2f - %6.2f, %6.2f - %6.2f\n", i, regions[i][0].name, 
 			    regions[i][0].Rmin, regions[i][0].Rmax, regions[i][0].Dmin, regions[i][0].Dmax);
@@ -114,2 +110,20 @@
 
 }
+
+
+int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside) {
+
+  while (r < Rmin) { r += 360.0; }
+  while (r > Rmax) { r -= 360.0; }
+
+  if (*leftside == -1) {
+    *leftside = (r < Rmid);
+  } else {
+    if (  *leftside && (r > Rmid + 90)) { r -= 360.0; }
+    if (! *leftside && (r < Rmid - 90)) { r += 360.0; }
+  }
+
+  RD_to_XY (x, y, r, d, coords);
+
+  return (TRUE);
+}
