summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libvxi11client/libvxi11client.c5
-rw-r--r--libvxi11client/perlbits/VXI11-Client.t5
2 files changed, 8 insertions, 2 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index f504def..743168f 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -243,6 +243,11 @@ int vxi11_docmd(VXI11Context* context, char* datain, int datainlen, char* dataou
.io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0,
.datasize = 0 };
+ if (datain == NULL)
+ datainlen = 0;
+ else if (datainlen == -1)
+ datainlen = strlen(datain);
+
params.data_in.data_in_len = datainlen;
params.data_in.data_in_val = datain;
diff --git a/libvxi11client/perlbits/VXI11-Client.t b/libvxi11client/perlbits/VXI11-Client.t
index 8a09a55..96d030b 100644
--- a/libvxi11client/perlbits/VXI11-Client.t
+++ b/libvxi11client/perlbits/VXI11-Client.t
@@ -8,7 +8,7 @@
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 17;
BEGIN { use_ok('VXI11::Client') };
#########################
@@ -41,7 +41,8 @@ is($instr->vxi_clear(), 1, "Clear");
is($instr->vxi_trigger(), 1, "Trigger");
is($instr->vxi_local(), 1, "Local");
is($instr->vxi_remote(), 1, "Remote");
-#ok($instr->vxi_docmd(1) < 1, "docmd"); #this should fail on the bb server
+my ($ret, $dataout, $dataoutlen) = $instr->vxi_docmd(1);
+ok($ret < 1, "docmd"); #this should fail on the bb server
is($instr->vxi_unlock(), 1, "Unlock");
is($instr->vxi_close(), 1, "Close");