Index: /trunk/Ohana/src/libohana/src/CommOps.c
===================================================================
--- /trunk/Ohana/src/libohana/src/CommOps.c	(revision 7938)
+++ /trunk/Ohana/src/libohana/src/CommOps.c	(revision 7939)
@@ -1,3 +1,6 @@
 # include <ohana.h>
+
+// XXX this is somewhat poor: the Send commands return TRUE / FALSE for success/failure
+// the Expect commands return 0 for success, -N for different errors
 
 int ExpectMessage (int device, double timeout, IOBuffer *message) {
@@ -7,5 +10,5 @@
 
   status = ExpectCommand (device, 16, timeout, &command);
-  if (status != 0) {
+  if (status) {
     FreeIOBuffer (&command);
     return (status);
@@ -82,8 +85,12 @@
 
   va_start (argp, format);
-  SendCommand (device, 16, "NBYTES: %6d", Nbyte);
-  status = SendCommandV (device, Nbyte, format, argp);
+  if (!SendCommand (device, 16, "NBYTES: %6d", Nbyte)) goto escape;
+  if (!SendCommandV (device, Nbyte, format, argp)) goto escape;
   va_end (argp);
-  return (status);
+  return TRUE;
+
+escape:
+  va_end (argp);
+  return FALSE;
 }
 
@@ -91,9 +98,7 @@
 int SendMessageFixed (int device, int length, char *message) {
 
-  int status;
-
-  status = SendCommand (device, 16, "NBYTES: %6d", length);
-  status = SendCommand (device, length, message);
-  return (status);
+  if (!SendCommand (device, 16, "NBYTES: %6d", length)) return FALSE;
+  if (!SendCommand (device, length, message)) return FALSE;
+  return TRUE;
 }
 
@@ -111,4 +116,5 @@
 int SendCommandV (int device, int length, char *format, va_list argp) {
 
+  int status;
   char *string;
 
@@ -118,6 +124,8 @@
   vsnprintf (string, length + 1, format, argp);
 
-  write (device, string, length);
+  status = write (device, string, length);
   free (string);
+
+  if (status == -1) return FALSE;
   return (TRUE);
 }
