depot/pkgs/development/tcl-modules/by-name/ex/expect/fix-darwin-bsd-clang16.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

36 lines
1.1 KiB
Diff

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,18 @@
*/
-#include <pty.h> /* openpty */
+/* openpty */
+#if defined(__APPLE__)
+# include <util.h>
+#elif defined(__FreeBSD__)
+# include <sys/types.h>
+# include <sys/ioctl.h>
+# include <termios.h>
+# include <libutil.h>
+#else /* pty.h is Linux-specific */
+# include <pty.h>
+#endif
+
#include <stdio.h>
#include <signal.h>