Index: trunk/Ohana/src/opihi/cmd.astro/gauss.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/gauss.c	(revision 3692)
+++ trunk/Ohana/src/opihi/cmd.astro/gauss.c	(revision 3693)
@@ -51,5 +51,5 @@
 
   fcntl (Ximage, F_SETFL, !O_NONBLOCK);  
-  write (Ximage, "CURS", 4); /* ask Ximage to look for the keystrokes */
+  SendGraphCommand (Ximage, 4, "CURS");
   
   for (i = 0; (i < Nspot) || (Nspot == 0); i++) {
@@ -64,5 +64,6 @@
     
   }
-  write (Ximage, "NCUR", 4); /* tell Ximage "end of keystrokes" */
+  SendGraphCommand (Ximage, 4, "NCUR");
+
   return (TRUE);
 }
Index: trunk/Ohana/src/opihi/cmd.astro/objload.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/objload.c	(revision 3692)
+++ trunk/Ohana/src/opihi/cmd.astro/objload.c	(revision 3693)
@@ -66,8 +66,8 @@
   free (buffer);
 
-  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);
   
+  /** NOTE: modify to use NBYTE **/
   ALLOCATE (buffer, char, 66000);
   bzero (buffer, 65536);
@@ -75,6 +75,5 @@
     snprintf (&buffer[Nout*128], 129, "%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, buffer, Nout*128);
       bzero (buffer, 65536);
@@ -84,10 +83,8 @@
 
   if (Nout) {
-    sprintf (line, "NLINES  %7d ", Nout);
-    write (Ximage, line, 16);
+    SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nout);
     write (Ximage, buffer, Nout*128);
   }
-  sprintf (line, "DONE ");
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "DONE");
 
   free (X);
Index: trunk/Ohana/src/opihi/cmd.astro/outline.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/outline.c	(revision 3692)
+++ trunk/Ohana/src/opihi/cmd.astro/outline.c	(revision 3693)
@@ -158,7 +158,6 @@
       Nline = 0;
       
-      write (Ximage, "LOAD", 4); /* force Ximage to look for the incoming image */
-      sprintf (line, "OVER %9d ", 0);
-      write (Ximage, line, 16);
+      SendGraphCommand (Ximage, 4, "LOAD");
+      SendGraphCommand (Ximage, 16, "OVER %9d ", 0);
       
       dx = par[2];
@@ -178,6 +177,5 @@
 	
 	if (Nline >= 510) {
-	  sprintf (line, "NLINES  %7d ", Nline);
-	  write (Ximage, line, 16);
+	  SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
 	  write (Ximage, buffer, Nline*128);
 	  bzero (buffer, 65536);
@@ -185,10 +183,9 @@
 	}
       }
-      
-      sprintf (line, "NLINES  %7d ", Nline);
-      write (Ximage, line, 16);
+
+      SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
       write (Ximage, buffer, Nline*128);
-      sprintf (line, "DONE ");
-      write (Ximage, line, 16);
+      SendGraphCommand (Ximage, 16, "DONE");
+
       free (buffer);
       free (line);
Index: trunk/Ohana/src/opihi/cmd.astro/outline2.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/outline2.c	(revision 3692)
+++ trunk/Ohana/src/opihi/cmd.astro/outline2.c	(revision 3693)
@@ -316,7 +316,6 @@
   Nline = 0;
   
-  write (Ximage, "LOAD", 4); /* force Ximage to look for the incoming image */
-  sprintf (line, "OVER %9d ", 0);
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 4, "LOAD");
+  SendGraphCommand (Ximage, 16, "OVER %9d ", 0);
   
   dx = par[2];
@@ -336,6 +335,5 @@
     
     if (Nline >= 510) {
-      sprintf (line, "NLINES  %7d ", Nline);
-      write (Ximage, line, 16);
+      SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
       write (Ximage, buffer, Nline*128);
       bzero (buffer, 65536);
@@ -344,9 +342,8 @@
   }
   
-  sprintf (line, "NLINES  %7d ", Nline);
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
   write (Ximage, buffer, Nline*128);
-  sprintf (line, "DONE ");
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "DONE");
+
   free (buffer);
   free (line);
