1 | #include <unistd.h> |
|
|
2 | #include <stdint.h> |
1 | #include <stdint.h> |
3 | #include <cstdlib> |
2 | #include <cstdlib> |
4 | #include <cstring> |
3 | #include <cstring> |
5 | |
4 | |
|
|
5 | #include <unistd.h> |
|
|
6 | #include <sys/utsname.h> |
|
|
7 | #include <limits.h> |
|
|
8 | |
6 | #include "rxvtdaemon.h" |
9 | #include "rxvtdaemon.h" |
7 | |
10 | |
8 | const char *rxvt_connection::unix_sockname () |
11 | char *rxvt_connection::unix_sockname () |
9 | { |
12 | { |
10 | return "/tmp/rxvtd~"; |
13 | char name[PATH_MAX]; |
|
|
14 | char *path = getenv ("RXVT_SOCKET"); |
|
|
15 | |
|
|
16 | if (!path) |
|
|
17 | { |
|
|
18 | struct utsname u; |
|
|
19 | uname (&u); |
|
|
20 | |
|
|
21 | path = getenv ("HOME"); |
|
|
22 | snprintf (name, PATH_MAX, "%s/.rxvt-%s", |
|
|
23 | path ? path : "/tmp", |
|
|
24 | u.nodename); |
|
|
25 | |
|
|
26 | path = name; |
|
|
27 | } |
|
|
28 | |
|
|
29 | return strdup (path); |
11 | } |
30 | } |
12 | |
31 | |
13 | void rxvt_connection::send (const char *data, int len) |
32 | void rxvt_connection::send (const char *data, int len) |
14 | { |
33 | { |
15 | uint8_t s[2]; |
34 | uint8_t s[2]; |