Index: trunk/Ohana/src/opihi/cmd.data/tvcontour.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/tvcontour.c	(revision 2843)
+++ trunk/Ohana/src/opihi/cmd.data/tvcontour.c	(revision 3693)
@@ -45,6 +45,5 @@
 Nline ++; \
 if (Nline == 512) { \
-  sprintf (line, "NLINES  %7d ", Nline); \
-  write (Ximage, line, 16); \
+  SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline); \
   write (Ximage, buffer, Nline*128); \
   bzero (buffer, 65536); \
@@ -57,6 +56,5 @@
 Nline ++; \
 if (Nline == 512) { \
-  sprintf (line, "NLINES  %7d ", Nline); \
-  write (Ximage, line, 16); \
+  SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline); \
   write (Ximage, buffer, Nline*128); \
   bzero (buffer, 65536); \
@@ -123,7 +121,6 @@
   }
 
-  write (Ximage, "LOAD", 4); /* force Ximage to look for the incoming image */
-  sprintf (line, "OVERLAY %7d ", n);
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 4, "LOAD"); /* force Ximage to look for the incoming image */
+  SendGraphCommand (Ximage, 16, "OVERLAY %7d ", n);
   ALLOCATE (buffer, char, 65536);  /* space for 512 lines of 128 bytes */
   bzero (buffer, 65536);
@@ -282,15 +279,12 @@
   
   if (Nline > 0) {
-    sprintf (line, "NLINES  %7d ", Nline); 
-    write (Ximage, line, 16); 
+    SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline); 
     write (Ximage, buffer, Nline*128); 
   }
 
   free (buffer);
-  sprintf (line, "DONE ");
-  write (Ximage, line, 16);
-  if (Npix != 1) {
-    free (matrix);
-  }
+  SendGraphCommand (Ximage, 16, "DONE"); 
+
+  if (Npix != 1) free (matrix);
   fprintf (stderr, "\n");
   return (TRUE);
