From 1d011a3ec05220a2a424acace6c43a6d9c1ab088 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 26 Mar 2004 18:08:54 +0000 Subject: OpenBSD support from Markus Friedl. --- src/cmd/9term/OpenBSD.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/cmd/9term/OpenBSD.c (limited to 'src') diff --git a/src/cmd/9term/OpenBSD.c b/src/cmd/9term/OpenBSD.c new file mode 100644 index 00000000..7f18bb43 --- /dev/null +++ b/src/cmd/9term/OpenBSD.c @@ -0,0 +1,46 @@ +#include +#include "9term.h" +#include +#include +#include +#include +#include +#include + +int +getpts(int fd[], char *slave) +{ + return openpty(&fd[1], &fd[0], slave, 0, 0); +} + +int +childpty(int fd[], char *slave) +{ + int sfd; + + close(fd[1]); + setsid(); + sfd = open(slave, ORDWR); + if(sfd < 0) + sysfatal("open %s: %r\n", slave); + if(ioctl(sfd, TIOCSCTTY, 0) < 0) + fprint(2, "ioctl TIOCSCTTY: %r\n"); + return sfd; +} + +struct winsize ows; + +void +updatewinsize(int row, int col, int dx, int dy) +{ + struct winsize ws; + + ws.ws_row = row; + ws.ws_col = col; + ws.ws_xpixel = dx; + ws.ws_ypixel = dy; + if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col) + if(ioctl(rcfd[0], TIOCSWINSZ, &ws) < 0) + fprint(2, "ioctl: %r\n"); + ows = ws; +} -- cgit v1.2.3