summaryrefslogtreecommitdiffhomepage
path: root/irssi-0.8.18.local.patch
blob: b34cfa7654e56570d570839509d90945e9437187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
--- irssi-0.8.18/build-aux/config.sub.orig	2016-02-08 20:16:25.000000000 +0000
+++ irssi-0.8.18/build-aux/config.sub	2016-03-06 18:06:18.154558135 +0000
@@ -804,6 +804,10 @@
 	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	midipix)
+		basic_machine=x86_64-pc
+		os=-midipix
+		;;
 	mingw64)
 		basic_machine=x86_64-pc
 		os=-mingw64
@@ -1384,7 +1388,7 @@
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
--- irssi-0.8.18/src/core/servers.c.orig	2016-01-20 22:08:07.000000000 +0000
+++ irssi-0.8.18/src/core/servers.c	2016-06-13 11:28:49.187797037 +0000
@@ -407,6 +407,36 @@
 		/* connect with unix socket */
 		server_real_connect(server, NULL, server->connrec->address);
 	} else {
+	#ifdef __midipix__
+		IPADDR ip4, ip6, *ip;
+
+		connect_address = server->connrec->proxy != NULL ?
+			server->connrec->proxy : server->connrec->address;
+		if (net_gethostbyname(connect_address, &ip4, &ip6) == -1) {
+			g_warning("net_gethostbyname(): -1");
+			g_free(server->tag);
+			g_free(server->nick);
+			return FALSE;
+		} else if (server->connrec->family == 0) {
+			/* prefer IPv4 addresses */
+			ip = ip4.family != 0 ? &ip4 : &ip6;
+		} else if (server->connrec->family == AF_INET6) {
+			/* IPv6 address, use if possible */
+			if (ip6.family != 0) {
+				ip = &ip6;
+			} else {
+				ip = &ip4;
+			}
+		} else {
+			/* IPv4 address, use if possible */
+			if (ip4.family != 0) {
+				ip = &ip4;
+			} else {
+				ip = &ip6;
+			}
+		}
+		server_real_connect(server, ip, NULL);
+	#else
 		/* resolve host name */
 		if (pipe(fd) != 0) {
 			g_warning("server_connect(): pipe() failed.");
@@ -433,6 +463,7 @@
 		lookup_servers = g_slist_append(lookup_servers, server);
 
 		signal_emit("server looking", 1, server);
+	#endif
 	}
 	return TRUE;
 }
--- irssi-0.8.18/src/core/network.c.orig	2016-02-08 21:20:37.000000000 +0100
+++ irssi-0.8.18/src/core/network.c	2016-06-17 16:34:16.870746400 +0200
@@ -572,9 +572,13 @@
 	int data;
 	socklen_t len = sizeof(data);
 
+#ifndef __midipix__
 	if (getsockopt(g_io_channel_unix_get_fd(handle),
 		       SOL_SOCKET, SO_ERROR, (void *) &data, &len) == -1)
 		return -1;
+#else
+	data = 0;
+#endif
 
 	return data;
 }
--- irssi-0.8.18/src/core/pidwait.c.orig	2014-09-02 11:13:51.000000000 +0200
+++ irssi-0.8.18/src/core/pidwait.c	2016-06-19 00:20:33.327763200 +0200
@@ -39,8 +39,10 @@
 void pidwait_add(int pid)
 {
 	if (g_hash_table_lookup(child_pids, GINT_TO_POINTER(pid)) == NULL) {
+#ifndef __midipix__
 		int id = g_child_watch_add_full(10, pid, sig_child, NULL, NULL);
 		g_hash_table_insert(child_pids, GINT_TO_POINTER(pid), GINT_TO_POINTER(id));
+#endif
 		pids = g_slist_append(pids, GINT_TO_POINTER(pid));
 	}
 }
--- irssi-0.8.18/src/fe-common/core/fe-exec.c.orig	2016-01-20 23:08:07.000000000 +0100
+++ irssi-0.8.18/src/fe-common/core/fe-exec.c	2016-06-19 01:22:40.792090300 +0200
@@ -288,6 +288,9 @@
 	}
 }
 
+#ifdef __midipix__
+static void sig_pidwait(void *pid, void *statusp);
+#endif
 static void process_exec(PROCESS_REC *rec, const char *cmd)
 {
 	const char *shell_args[4] = { "/bin/sh", "-c", NULL, NULL };
@@ -535,6 +538,14 @@
 				    (GInputFunction) sig_exec_input_reader,
 				    rec);
 	processes = g_slist_append(processes, rec);
+#ifdef __midipix__
+	int status;
+	waitpid(rec->pid, &status, 0);
+	while (rec->read_tag != -1) {
+		sig_exec_input_reader(rec);
+	}
+	sig_pidwait((void *)rec->pid, &status);
+#endif
 
 	if (rec->target == NULL && interactive)
 		rec->target_item = exec_wi_create(active_win, rec);