-
Notifications
You must be signed in to change notification settings - Fork 8
/
error.c
53 lines (46 loc) · 1.08 KB
/
error.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* File name: error.c */
#include "common.h"
int main() {
K result;
I port= 12345;
I timeout= 5000;
I handle;
handle= khpun("localhost", port, "kdb:pass", timeout);
if(!handleOk(handle))
return EXIT_FAILURE;
result= k(handle, "1+`2", (K) 0);
// Handle network error
if(!result) {
perror("Network Error\n");
kclose(handle);
return EXIT_FAILURE;
}
if(-128 == result->t) {
fprintf(stderr, "Error message returned : %s\n", result->s);
}
r0(result);
result= k(handle, "`a`b`c=`a`b", (K) 0);
// Handle network error
if(!result) {
perror("Network Error\n");
kclose(handle);
return EXIT_FAILURE;
}
if(-128 == result->t) {
fprintf(stderr, "Error message returned : %s\n", result->s);
}
r0(result);
result= k(handle, "select sym t :([] sym:`a`b)", (K) 0);
// Handle network error
if(!result) {
perror("Network Error\n");
kclose(handle);
return EXIT_FAILURE;
}
if(-128 == result->t) {
fprintf(stderr, "Error message returned : %s\n", result->s);
}
r0(result);
kclose(handle);
return EXIT_SUCCESS;
}