commit 7321ed031ceb9494751a8deb85fd224ff0520c39
parent a6a352886851eb0188b8c31e33933d4deb481d2e
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:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/cmd/9term/Darwin.c b/src/cmd/9term/Darwin.c
@@ -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;
+}