t9term: use openpty on NetBSD - 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 0a7fe606818a7906cdc57ea14cb57b416be6c1de
(DIR) parent 8b9aaf2e3f7f6e2733e52db4dd1dcb46a91e4972
(HTM) Author: Nicola Girardi <nicola@aloc.in>
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(-)
---
(DIR) 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 <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: %r");
+ return 0;
+}