Index: trunk/Ohana/src/opihi/Makefile.Common
===================================================================
--- trunk/Ohana/src/opihi/Makefile.Common	(revision 6683)
+++ trunk/Ohana/src/opihi/Makefile.Common	(revision 6684)
@@ -26,10 +26,6 @@
 $(DESTLIB)/%.a: $(LIB)/%.$(ARCH).a
 	@if [ ! -d $(DESTLIB) ]; then mkdir -p $(DESTLIB); fi
-	@echo ""
-	@echo "current: $^"
-	@echo "current: $*"
-	@echo "current: $@"
 	rm -f $@
-	cp $^ $@
+	cp $< $@
 
 lib%.clean:
Index: trunk/Ohana/src/opihi/cmd.data/Makefile
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 6683)
+++ trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 6684)
@@ -26,4 +26,5 @@
 $(SDIR)/clear.$(ARCH).o		\
 $(SDIR)/clip.$(ARCH).o		\
+$(SDIR)/close.$(ARCH).o		\
 $(SDIR)/concat.$(ARCH).o	\
 $(SDIR)/contour.$(ARCH).o	\
Index: trunk/Ohana/src/opihi/cmd.data/box.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/box.c	(revision 6683)
+++ trunk/Ohana/src/opihi/cmd.data/box.c	(revision 6684)
@@ -6,4 +6,12 @@
   Graphdata graphmode;
   
+  Ngraph = -1;
+  if ((N = get_argument (argc, argv, "-n"))) {
+    remove_argument (N, &argc, argv);
+    Ngraph = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+  if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);
+
   strcpy (graphmode.ticks, "2222");
   if ((N = get_argument (argc, argv, "-ticks"))) {
@@ -38,12 +46,4 @@
     }
   }
-
-  Ngraph = -1;
-  if ((N = get_argument (argc, argv, "-n"))) {
-    remove_argument (N, &argc, argv);
-    Ngraph = atof (argv[N]);
-    remove_argument (N, &argc, argv);
-  }
-  if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);
 
   if (argc != 1) goto usage;
Index: trunk/Ohana/src/opihi/cmd.data/init.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/init.c	(revision 6683)
+++ trunk/Ohana/src/opihi/cmd.data/init.c	(revision 6684)
@@ -9,4 +9,5 @@
 int clear            PROTO((int, char **));
 int clip             PROTO((int, char **));
+int close_device     PROTO((int, char **));
 int concat           PROTO((int, char **));
 int contour          PROTO((int, char **));
@@ -115,4 +116,5 @@
   {"clear",   	   clear,	     "erase plot"},
   {"clip",         clip,	     "clip values in a buffer to be within a range"},
+  {"close",        close_device,     "close the current display device"},
   {"concat",  	   concat,	     "reduce vector dimension"},
   {"contour", 	   contour,	     "create contour from image"},
Index: trunk/Ohana/src/opihi/dvo/LoadImages.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/LoadImages.c	(revision 6683)
+++ trunk/Ohana/src/opihi/dvo/LoadImages.c	(revision 6684)
@@ -3,9 +3,12 @@
 Image *LoadImages (int *nimage) {
 
-  char filename[256];
+  char *catdir, filename[256];
   Image *image;
   FITS_DB db;
   
-  VarConfig ("IMAGE_CATALOG", "%s", filename);
+  /* VarConfig ("IMAGE_CATALOG", "%s", filename); */
+
+  catdir = GetCATDIR ();
+  sprintf (filename, "%s/Images.dat", catdir);
 
   fits_db_init (&db);
Index: trunk/Ohana/src/opihi/dvo/catdir.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/catdir.c	(revision 6683)
+++ trunk/Ohana/src/opihi/dvo/catdir.c	(revision 6684)
@@ -3,4 +3,5 @@
 int catdir_define (int argc, char **argv) {
   
+  char *current;
   int status, N, VERBOSE;
 
@@ -14,4 +15,10 @@
     fprintf (stderr, "USAGE: catdir (name)\n");
     fprintf (stderr, "       (name) may be a path or 'default'\n");
+    current = GetCATDIR ();
+    if (current == NULL) {
+      fprintf (stderr, "catdir not defined\n");
+    } else {
+      fprintf (stderr, "current: %s\n", current);
+    }
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/dvo/region_list.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/region_list.c	(revision 6683)
+++ trunk/Ohana/src/opihi/dvo/region_list.c	(revision 6684)
@@ -11,5 +11,5 @@
 
   char *newpath;
-  char catdir[256];
+  char catdir_config[256];
   char gscfile[256];
   char skyfile[256];
@@ -18,6 +18,6 @@
   /* find CATDIR in config system */
   if (path == NULL) {
-    if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE);
-    newpath = catdir;
+    if (VarConfig ("CATDIR", "%s", catdir_config) == NULL) return (FALSE);
+    newpath = catdir_config;
   } else {
     newpath = path;
@@ -32,5 +32,5 @@
 
   if (verbose) {
-      fprintf (stderr, "CATDIR %s\n", catdir);
+      fprintf (stderr, "CATDIR %s\n", CATDIR);
       fprintf (stderr, "GSCFILE %s\n", gscfile);
       fprintf (stderr, "SKYFILE %s\n", skyfile);
@@ -42,10 +42,17 @@
 
   if (sky != NULL) SkyTableFree (sky);
-  sky = SkyTableLoadOptimal (catdir, skyfile, gscfile, skydepth, verbose);
+  sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, skydepth, verbose);
   if (sky == NULL) return FALSE;
 
-  SkyTableSetFilenames (sky, catdir, "cpt");
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
 
   return (TRUE);
+}
+
+char *GetCATDIR () {
+  if (CATDIR == NULL) {
+    SetCATDIR (NULL, FALSE);
+  }
+  return (CATDIR);
 }
 
Index: trunk/Ohana/src/opihi/include/display.h
===================================================================
--- trunk/Ohana/src/opihi/include/display.h	(revision 6683)
+++ trunk/Ohana/src/opihi/include/display.h	(revision 6684)
@@ -24,4 +24,5 @@
 void          InitGraph             PROTO((void));
 int           open_graph            PROTO((int N));
+int           close_graph           PROTO((int N));
 void          QuitGraph             PROTO((void));
 void          SetGraph              PROTO((Graphdata data));
@@ -35,4 +36,5 @@
 void          InitImage             PROTO((void));
 int           open_image            PROTO((int N));
+int           close_image           PROTO((int N));
 void          QuitImage             PROTO((void));
 void          SetImageDevice        PROTO((int state));
Index: trunk/Ohana/src/opihi/include/dvo1.h
===================================================================
--- trunk/Ohana/src/opihi/include/dvo1.h	(revision 6683)
+++ trunk/Ohana/src/opihi/include/dvo1.h	(revision 6684)
@@ -73,4 +73,5 @@
 SkyList      *SkyListLoadFile       PROTO((char *filename));
 int           SetCATDIR             PROTO((char *path, int verbose));
+char *        GetCATDIR             PROTO(());
 SkyTable     *GetSkyTable           PROTO(());
 SkyList      *SkyListFromFile       PROTO((char *filename));
Index: trunk/Ohana/src/opihi/lib.data/open_graph.c
===================================================================
--- trunk/Ohana/src/opihi/lib.data/open_graph.c	(revision 6683)
+++ trunk/Ohana/src/opihi/lib.data/open_graph.c	(revision 6684)
@@ -8,6 +8,4 @@
 static int       Xgraph[NXGRAPH];  
 static Graphdata graphdata[NXGRAPH];
-
-
 
 void QuitGraph () {
@@ -80,4 +78,14 @@
 
   Xgraph[N] = fd;
+  return (TRUE);
+}
+
+int close_graph (int N) {
+
+  if (N <  0) return (FALSE);
+  if (N >= NXGRAPH) return (FALSE);
+
+  KiiClose (Xgraph[N]); 
+  Xgraph[N] = -1;
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/lib.data/open_image.c
===================================================================
--- trunk/Ohana/src/opihi/lib.data/open_image.c	(revision 6683)
+++ trunk/Ohana/src/opihi/lib.data/open_image.c	(revision 6684)
@@ -33,22 +33,4 @@
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 /* set SIGPIPE to this function to close cleanly */ 
 void XImageDead (int input) {
@@ -80,4 +62,14 @@
 
   Ximage[N] = fd;
+  return (TRUE);
+}
+
+int close_image (int N) {
+
+  if (N <  0) return (FALSE);
+  if (N >= NXIMAGE) return (FALSE);
+
+  KiiClose (Ximage[N]); 
+  Ximage[N] = -1;
   return (TRUE);
 }
