summary refs log tree commit diff
path: root/pkgs/tools/misc/expect/fix-darwin-clang16.patch
blob: 9454769c99c8f61dcbdeacd9288c8dcb4f3cc0c7 (plain) (blame)
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
diff -ur a/exp_win.c b/exp_win.c
--- a/exp_win.c	2018-02-02 14:15:52.000000000 -0500
+++ b/exp_win.c	2023-10-10 07:47:33.082690432 -0400
@@ -39,7 +39,8 @@
 /* Sigh.  On AIX 2.3, termios.h exists but does not define TIOCGWINSZ */
 /* Instead, it has to come from ioctl.h.  However, As I said above, this */
 /* can't be cavalierly included on all machines, even when it exists. */
-#if defined(HAVE_TERMIOS) && !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H)
+/* Darwin also has termios.h, but it requires ioctl.h for `ioctl`. */
+#if defined(HAVE_TERMIOS) && (defined(__APPLE__) || !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H))
 #  include <sys/ioctl.h>
 #endif
 
diff -ur d/pty_termios.c c/pty_termios.c
--- d/pty_termios.c	2023-10-10 07:59:23.244452442 -0400
+++ c/pty_termios.c	2023-10-10 08:00:35.303231582 -0400
@@ -7,7 +7,13 @@
 
 */
 
-#include <pty.h> /* openpty */
+/* openpty */
+#ifdef __APPLE__
+#include <util.h>
+#else /* pty.h is Linux-specific */
+#include <pty.h>
+#endif
+
 #include <stdio.h>
 #include <signal.h>