… | |
… | |
23 | void rxvt_connection::send (const char *data) |
23 | void rxvt_connection::send (const char *data) |
24 | { |
24 | { |
25 | send (data, strlen (data)); |
25 | send (data, strlen (data)); |
26 | } |
26 | } |
27 | |
27 | |
28 | bool rxvt_connection::recv (char *&data, int *len) |
28 | bool rxvt_connection::recv (auto_str &data, int *len) |
29 | { |
29 | { |
30 | uint8_t s[2]; |
30 | uint8_t s[2]; |
31 | int l; |
31 | int l; |
32 | |
32 | |
33 | if (read (fd, s, 2) != 2) |
33 | if (read (fd, s, 2) != 2) |
… | |
… | |
51 | data[l] = 0; |
51 | data[l] = 0; |
52 | |
52 | |
53 | return true; |
53 | return true; |
54 | } |
54 | } |
55 | |
55 | |
56 | bool rxvt_connection::recv (token &data) |
|
|
57 | { |
|
|
58 | char *d; |
|
|
59 | int l; |
|
|
60 | |
|
|
61 | if (!recv (d, &l)) |
|
|
62 | return false; |
|
|
63 | |
|
|
64 | if (l < sizeof (token) - 1) |
|
|
65 | strcpy (data, d); |
|
|
66 | |
|
|
67 | delete [] d; |
|
|
68 | |
|
|
69 | return l < sizeof (token) - 1; |
|
|
70 | } |
|
|
71 | |
|
|
72 | void rxvt_connection::send (int data) |
56 | void rxvt_connection::send (int data) |
73 | { |
57 | { |
74 | uint8_t s[4]; |
58 | uint8_t s[4]; |
75 | |
59 | |
76 | s[0] = data >> 24; s[1] = data >> 16; s[0] = data >> 8; s[1] = data; |
60 | s[0] = data >> 24; s[1] = data >> 16; s[0] = data >> 8; s[1] = data; |