summaryrefslogtreecommitdiff
path: root/libvxi11client/libvxi11client.c
diff options
context:
space:
mode:
authordaniel <danieruru@gmail.com>2013-01-18 02:40:49 +0900
committerdaniel <danieruru@gmail.com>2013-01-18 02:40:49 +0900
commit425b461dfe9f330f7bb35061c6cce4c78fbcc5aa (patch)
tree64194fdb9a610258db222d1f34651317a77db243 /libvxi11client/libvxi11client.c
parent3bcf349f108248fc3ca705ff1fc8b56923e8bfa4 (diff)
add a lazy way to call write
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r--libvxi11client/libvxi11client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index 4b17532..a6a5dd2 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -171,16 +171,17 @@ int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) {
}
/**
- * write to the connected device
+ * write to the connected device. If len is less than 0 the length will be calculated with strlen
+ * **only safe for standard terminated strings**
*/
-int vxi11_write(VXI11Context* context, char* data, unsigned int len, bool waitlock, bool end) {
+int vxi11_write(VXI11Context* context, char* data, int len, bool waitlock, bool end) {
if (context->clnt == NULL)
return 0;
Device_WriteParms params = { .lid = context->devicelink, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout =
VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) };
- params.data.data_len = len;
+ params.data.data_len = len < 0 ? (strlen(data) + 1) : len;
params.data.data_val = data;
Device_WriteResp* resp = device_write_1(&params, context->clnt);