9term: use openpty on NetBSD

Fixes #376.
This commit is contained in:
Nicola Girardi 2020-03-20 18:52:41 +00:00 committed by Russ Cox
parent 8b9aaf2e3f
commit 0a7fe60681

View file

@ -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;
}