Index: trunk/Ohana/src/opihi/dvo/cmpload.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/cmpload.c	(revision 3462)
+++ trunk/Ohana/src/opihi/dvo/cmpload.c	(revision 3693)
@@ -12,7 +12,7 @@
   double dtmp;
   FILE *f;
-  char *buffer, *buffer2, *line;
+  char *buffer, *buffer2;
+  int Ximage, Nimage;
   Header header;
-  int Ximage, Nimage;
   
   Nimage = -1;
@@ -121,16 +121,13 @@
   fclose (f);
 
-  ALLOCATE (line, char, 129);
-  write (Ximage, "LOAD", 4); /* force Ximage to look for the incoming image */
-  sprintf (line, "OVER %9d ", n);
-  write (Ximage, line, 16);
-  
+  SendGraphCommand (Ximage, 4, "LOAD");
+  SendGraphCommand (Ximage, 16, "OVER %9d ", n);
   ALLOCATE (buffer2, char, 66000);
   bzero (buffer2, 65536);
+
   for (Nout = i = 0; i < Nin; i++, Nout++) {
     sprintf (&buffer2[Nout*128], "%15s %20.10f %20.10f %20.10f %20.10f ", "BOX", X[i], Y[i], 5.0, 5.0);
     if (Nout == 512) {
-      sprintf (line, "NLINES  %7d ", Nout);
-      write (Ximage, line, 16);
+      SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nout);
       write (Ximage, buffer2, Nout*128);
       bzero (buffer2, 65536);
@@ -140,10 +137,8 @@
 
   if (Nout) {
-    sprintf (line, "NLINES  %7d ", Nout);
-    write (Ximage, line, 16);
+    SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nout);
     write (Ximage, buffer2, Nout*128);
   }
-  sprintf (line, "DONE ");
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "DONE");
 
   fits_free_header (&header);
@@ -152,8 +147,5 @@
   free (M);
   free (buffer);
-  /*  */
-
   free (buffer2);
-  free (line);
 
   fprintf (stderr, "loaded %d objects\n", Nin);
