mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Add support for Cgywin, apparently it is enough just to open the tty again in
the server and fd passing is not necessary. Needs some ifdefs unfortunately but no way around that and some of them can go next time we're willing to do a protocol bump. Patch from J Raynor jxraynor at gmail dot com.
This commit is contained in:
parent
bdea2f9eda
commit
e8567098a4
5
client.c
5
client.c
@ -328,8 +328,13 @@ client_send_identify(int flags)
|
|||||||
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
|
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
|
||||||
*data.term = '\0';
|
*data.term = '\0';
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
snprintf(&data.ttyname, sizeof data.ttyname, "%s",
|
||||||
|
ttyname(STDIN_FILENO));
|
||||||
|
#else
|
||||||
if ((fd = dup(STDIN_FILENO)) == -1)
|
if ((fd = dup(STDIN_FILENO)) == -1)
|
||||||
fatal("dup failed");
|
fatal("dup failed");
|
||||||
|
#endif
|
||||||
imsg_compose(&client_ibuf,
|
imsg_compose(&client_ibuf,
|
||||||
MSG_IDENTIFY, PROTOCOL_VERSION, -1, fd, &data, sizeof data);
|
MSG_IDENTIFY, PROTOCOL_VERSION, -1, fd, &data, sizeof data);
|
||||||
client_update_event();
|
client_update_event();
|
||||||
|
5
compat.h
5
compat.h
@ -30,6 +30,10 @@
|
|||||||
#define __packed __attribute__ ((__packed__))
|
#define __packed __attribute__ ((__packed__))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECHOPRT
|
||||||
|
#define ECHOPRT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_BSD_TYPES
|
#ifndef HAVE_BSD_TYPES
|
||||||
typedef uint8_t u_int8_t;
|
typedef uint8_t u_int8_t;
|
||||||
typedef uint16_t u_int16_t;
|
typedef uint16_t u_int16_t;
|
||||||
@ -210,6 +214,7 @@ int daemon(int, int);
|
|||||||
|
|
||||||
#ifndef HAVE_B64_NTOP
|
#ifndef HAVE_B64_NTOP
|
||||||
/* b64_ntop.c */
|
/* b64_ntop.c */
|
||||||
|
#undef b64_ntop /* for Cygwin */
|
||||||
int b64_ntop(const char *, size_t, char *, size_t);
|
int b64_ntop(const char *, size_t, char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -825,9 +825,12 @@ server_client_msg_dispatch(struct client *c)
|
|||||||
case MSG_IDENTIFY:
|
case MSG_IDENTIFY:
|
||||||
if (datalen != sizeof identifydata)
|
if (datalen != sizeof identifydata)
|
||||||
fatalx("bad MSG_IDENTIFY size");
|
fatalx("bad MSG_IDENTIFY size");
|
||||||
|
memcpy(&identifydata, imsg.data, sizeof identifydata);
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
imsg.fd = open(identifydata.ttyname, O_RDWR|O_NOCTTY);
|
||||||
|
#endif
|
||||||
if (imsg.fd == -1)
|
if (imsg.fd == -1)
|
||||||
fatalx("MSG_IDENTIFY missing fd");
|
fatalx("MSG_IDENTIFY missing fd");
|
||||||
memcpy(&identifydata, imsg.data, sizeof identifydata);
|
|
||||||
|
|
||||||
server_client_msg_identify(c, &identifydata, imsg.fd);
|
server_client_msg_identify(c, &identifydata, imsg.fd);
|
||||||
break;
|
break;
|
||||||
|
4
tmux.h
4
tmux.h
@ -471,6 +471,10 @@ struct msg_identify_data {
|
|||||||
|
|
||||||
char term[TERMINAL_LENGTH];
|
char term[TERMINAL_LENGTH];
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
char ttyname[TTY_NAME_MAX];
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IDENTIFY_UTF8 0x1
|
#define IDENTIFY_UTF8 0x1
|
||||||
#define IDENTIFY_256COLOURS 0x2
|
#define IDENTIFY_256COLOURS 0x2
|
||||||
/* 0x4 unused */
|
/* 0x4 unused */
|
||||||
|
Loading…
Reference in New Issue
Block a user