Changeset 7939
- Timestamp:
- Jul 19, 2006, 10:27:38 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libohana/src/CommOps.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/src/CommOps.c
r7929 r7939 1 1 # include <ohana.h> 2 3 // XXX this is somewhat poor: the Send commands return TRUE / FALSE for success/failure 4 // the Expect commands return 0 for success, -N for different errors 2 5 3 6 int ExpectMessage (int device, double timeout, IOBuffer *message) { … … 7 10 8 11 status = ExpectCommand (device, 16, timeout, &command); 9 if (status != 0) {12 if (status) { 10 13 FreeIOBuffer (&command); 11 14 return (status); … … 82 85 83 86 va_start (argp, format); 84 SendCommand (device, 16, "NBYTES: %6d", Nbyte);85 status = SendCommandV (device, Nbyte, format, argp);87 if (!SendCommand (device, 16, "NBYTES: %6d", Nbyte)) goto escape; 88 if (!SendCommandV (device, Nbyte, format, argp)) goto escape; 86 89 va_end (argp); 87 return (status); 90 return TRUE; 91 92 escape: 93 va_end (argp); 94 return FALSE; 88 95 } 89 96 … … 91 98 int SendMessageFixed (int device, int length, char *message) { 92 99 93 int status; 94 95 status = SendCommand (device, 16, "NBYTES: %6d", length); 96 status = SendCommand (device, length, message); 97 return (status); 100 if (!SendCommand (device, 16, "NBYTES: %6d", length)) return FALSE; 101 if (!SendCommand (device, length, message)) return FALSE; 102 return TRUE; 98 103 } 99 104 … … 111 116 int SendCommandV (int device, int length, char *format, va_list argp) { 112 117 118 int status; 113 119 char *string; 114 120 … … 118 124 vsnprintf (string, length + 1, format, argp); 119 125 120 write (device, string, length);126 status = write (device, string, length); 121 127 free (string); 128 129 if (status == -1) return FALSE; 122 130 return (TRUE); 123 131 }
Note:
See TracChangeset
for help on using the changeset viewer.
