Skip to content

Instantly share code, notes, and snippets.

@10sr
Last active December 18, 2015 13:59
Show Gist options
  • Save 10sr/5794078 to your computer and use it in GitHub Desktop.
Save 10sr/5794078 to your computer and use it in GitHub Desktop.
--- client.c.orig 2013-06-02 15:29:03.175177500 -0500
+++ client.c 2013-06-02 15:32:59.124455900 -0500
@@ -328,8 +328,12 @@
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
*data.term = '\0';
+#ifdef __CYGWIN__
+ snprintf(&data.ttyname, sizeof(data.ttyname), "%s", ttyname(STDIN_FILENO));
+#else
if ((fd = dup(STDIN_FILENO)) == -1)
fatal("dup failed");
+#endif
imsg_compose(&client_ibuf,
MSG_IDENTIFY, PROTOCOL_VERSION, -1, fd, &data, sizeof data);
client_update_event();
--- compat.h.orig 2013-06-02 15:29:11.627331100 -0500
+++ compat.h 2013-06-02 15:37:16.692688900 -0500
@@ -198,6 +198,10 @@
#ifndef HAVE_B64_NTOP
/* b64_ntop.c */
+#ifdef __CYGWIN__
+#undef b64_ntop
+#endif
+
int b64_ntop(const char *, size_t, char *, size_t);
#endif
@@ -242,4 +246,8 @@
#define optarg BSDoptarg
#endif
+#ifndef ECHOPRT
+#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
+#endif
+
#endif /* COMPAT_H */
--- server-client.c.orig 2013-06-02 15:29:19.949297500 -0500
+++ server-client.c 2013-06-02 15:32:59.164513500 -0500
@@ -823,9 +823,12 @@
case MSG_IDENTIFY:
if (datalen != sizeof identifydata)
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)
fatalx("MSG_IDENTIFY missing fd");
- memcpy(&identifydata, imsg.data, sizeof identifydata);
server_client_msg_identify(c, &identifydata, imsg.fd);
break;
--- tmux.h.orig 2013-06-02 15:29:33.138262300 -0500
+++ tmux.h 2013-06-02 15:33:32.450244100 -0500
@@ -475,6 +475,10 @@
char term[TERMINAL_LENGTH];
+#ifdef __CYGWIN__
+ char ttyname[TTY_NAME_MAX];
+#endif
+
#define IDENTIFY_UTF8 0x1
#define IDENTIFY_256COLOURS 0x2
#define IDENTIFY_88COLOURS 0x4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment