Index: trunk/Ohana/src/opihi/cmd.data/tv.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/tv.c	(revision 2843)
+++ trunk/Ohana/src/opihi/cmd.data/tv.c	(revision 3692)
@@ -7,5 +7,5 @@
   double a1, a2, max, min, zero, range;
   float *in;
-  char *out, *outbuffer, *p, *tmpstring;
+  char *out, *outbuffer, *root;
   int Ximage, Nimage;
   Coords coords;
@@ -56,5 +56,5 @@
   out = outbuffer;
 
-  status = write (Ximage, "READ", 4); /* tell Ximage to look for the incoming image */
+  SendGraphCommand (Ximage, 4, "READ"); /* tell Ximage to look for the incoming image */
 
   /* convert from (float) internal rep to 1 byte chars -- depends on how many colors Kii owns*/
@@ -81,36 +81,13 @@
   
   /* done with the conversion, now send Ximage the converted picture */
-  sprintf (buffer, "%8d %8d 8 1 %f %f ", buf[0].matrix.Naxis[0], buf[0].matrix.Naxis[1], 0.0, 1.0);
-  sprintf (buffer2, "NBYTES: %6d ", strlen (buffer));
-  write (Ximage, buffer2, 16);
-  write (Ximage, buffer, strlen (buffer));
-  
-  sprintf (buffer, "%f %f %f %f %d ", zero, range, min, max, size);
-  sprintf (buffer2, "NBYTES: %6d ", strlen (buffer));
-  write (Ximage, buffer2, 16);
-  write (Ximage, buffer, strlen (buffer));
+  SendGraphMessage (Ximage, "%8d %8d 8 1 %f %f", buf[0].matrix.Naxis[0], buf[0].matrix.Naxis[1], 0.0, 1.0);
+  SendGraphMessage (Ximage, "%f %f %f %f %d ", zero, range, min, max, size);
+  SendGraphMessage (Ximage, "%f %f %g %g %g ", coords.crval1, coords.crpix1, coords.cdelt1, coords.pc1_1, coords.pc1_2);
+  SendGraphMessage (Ximage, "%f %f %g %g %g ", coords.crval2, coords.crpix2, coords.cdelt2, coords.pc2_1, coords.pc2_2);
 
-  sprintf (buffer, "%f %f %g %g %g ", coords.crval1, coords.crpix1, coords.cdelt1, coords.pc1_1, coords.pc1_2);
-  sprintf (buffer2, "NBYTES: %6d ", strlen (buffer));
-  write (Ximage, buffer2, 16);
-  write (Ximage, buffer, strlen (buffer));
-
-  sprintf (buffer, "%f %f %g %g %g ", coords.crval2, coords.crpix2, coords.cdelt2, coords.pc2_1, coords.pc2_2);
-  sprintf (buffer2, "NBYTES: %6d ", strlen (buffer));
-  write (Ximage, buffer2, 16);
-  write (Ximage, buffer, strlen (buffer));
-
-  p = strrchr (buf[0].file, '/');
-  if (p == (char *) NULL) p = buf[0].file;
-  else p++;
-  tmpstring = strcreate (p);
-  sprintf (buffer, "%s %s %s ", coords.ctype, tmpstring, buf[0].name);
-  free (tmpstring);
-  sprintf (buffer2, "NBYTES: %6d ", strlen (buffer));
-  write (Ximage, buffer2, 16);
-  write (Ximage, buffer, strlen (buffer));
+  root = filerootname (buf[0].file);
+  SendGraphMessage (Ximage, "%s %s %s ", coords.ctype, root, buf[0].name);
 
   write (Ximage, outbuffer, size);
-
   free (outbuffer);
 
@@ -118,5 +95,4 @@
   set_str_variable ("TV", argv[1]);
   return (TRUE);
-
 }
 
