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