plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 0a7fe606818a7906cdc57ea14cb57b416be6c1de
parent 8b9aaf2e3f7f6e2733e52db4dd1dcb46a91e4972
Author: Nicola Girardi <nicola@aloc.in>
Date:   Fri, 20 Mar 2020 18:52:41 +0000

9term: use openpty on NetBSD

Fixes #376.

Diffstat:
Msrc/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 @@ -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; +}