summaryrefslogtreecommitdiff
path: root/libvxi11client
diff options
context:
space:
mode:
Diffstat (limited to 'libvxi11client')
-rw-r--r--libvxi11client/client.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libvxi11client/client.c b/libvxi11client/client.c
index d75ddd5..f946547 100644
--- a/libvxi11client/client.c
+++ b/libvxi11client/client.c
@@ -7,6 +7,8 @@ static char* geterrorstring(int errorcode) {
switch (errorcode) {
case 0:
return "no response from server";
+ case -8:
+ return "operation not supported";
default:
return "unknown error code";
}
@@ -17,7 +19,7 @@ int main() {
int err = 0;
- if (vxi11_open("192.168.2.250")) {
+ if ((err = vxi11_open("192.168.2.250")) > 0) {
// write some bytes
int byteswritten = vxi11_write(IDENTIFY, sizeof(IDENTIFY));
@@ -34,33 +36,33 @@ int main() {
printf("Error reading data\n");
// trigger
- if (vxi11_trigger())
+ if (vxi11_trigger() > 0)
printf("triggered\n");
// clear
- if (vxi11_clear())
+ if (vxi11_clear() > 0)
printf("cleared\n");
// abort
- if ((err = vxi11_abort()))
+ if ((err = vxi11_abort()) > 0)
printf("aborted\n");
else
printf("abort failed; %s\n", geterrorstring(err));
// lock
- if (vxi11_lock())
+ if ((err = vxi11_lock()) > 0)
printf("locked\n");
// unlock
- if (vxi11_unlock())
+ if ((err = vxi11_unlock()) > 0)
printf("unlocked\n");
// remote
- if (vxi11_remote())
+ if ((err = vxi11_remote()) > 0)
printf("remote'd\n");
// local
- if (vxi11_local())
+ if ((err = vxi11_local()) > 0)
printf("local'd\n");
// read the status byte
@@ -71,24 +73,26 @@ int main() {
printf("Error reading status byte\n");
// create interrupt channel
- vxi11_create_intr_chan();
+ err = vxi11_create_intr_chan();
// destroy interrupt channel
- if ((err = vxi11_destroy_intr_chan()))
+ if ((err = vxi11_destroy_intr_chan()) > 0)
printf("destroyed interrupt channel\n");
else
printf("Error destroying interrupt channel; %s\n", geterrorstring(err));
// docmd
- if ((err = vxi11_docmd(0x00)))
- printf("did command, should fail!\n");
+ if ((err = vxi11_docmd(0x00)) > 0)
+ printf("did command, should fail! %d\n");
else
- printf("Error calling docmd; %\n", geterrorstring(err));
+ printf("Error calling docmd; %s\n", geterrorstring(err));
// close
- vxi11_close();
+ if ((err = vxi11_close() > 0))
+ printf("Closed\n");
}
else {
+ printf("Error opening device; %s\n", geterrorstring(err));
exit(1);
}
}