t9term: fix getpts on macOS 10.13 - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 7321ed031ceb9494751a8deb85fd224ff0520c39
(DIR) parent a6a352886851eb0188b8c31e33933d4deb481d2e
(HTM) Author: David du Colombier <0intro@gmail.com>
Date: Fri, 13 Oct 2017 10:26:51 +0200
9term: fix getpts on macOS 10.13
Since macOS 10.13, opening the /dev/ptyXX files
always return ENOENT.
Consequently, we changed getpts to use openpty to
open a pseudoterminal, like on Linux and OpenBSD.
Fixes #90.
Fixes #110.
Diffstat:
M src/cmd/9term/Darwin.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/cmd/9term/Darwin.c b/src/cmd/9term/Darwin.c
t@@ -1 +1,17 @@
+#define getpts not_using_this_getpts
#include "bsdpty.c"
+#undef getpts
+
+#include <util.h>
+
+int
+getpts(int fd[], char *slave)
+{
+ if(openpty(&fd[1], &fd[0], NULL, NULL, NULL) >= 0){
+ fchmod(fd[1], 0620);
+ strcpy(slave, ttyname(fd[0]));
+ return 0;
+ }
+ sysfatal("no ptys");
+ return 0;
+}