t9term: use openpty on NetBSD - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 0a7fe606818a7906cdc57ea14cb57b416be6c1de
parent 8b9aaf2e3f7f6e2733e52db4dd1dcb46a91e4972
Author: Nicola Girardi 
Date:   Fri, 20 Mar 2020 18:52:41 +0000

9term: use openpty on NetBSD

Fixes #376.

Diffstat:
  M src/cmd/9term/NetBSD.c              |      16 ++++++++++++++++

1 file changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/cmd/9term/NetBSD.c b/src/cmd/9term/NetBSD.c
t@@ -1 +1,17 @@
+#define getpts not_using_this_getpts
 #include "bsdpty.c"
+#undef getpts
+
+#include 
+
+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: %r");
+        return 0;
+}