mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
OpenBSD support from Markus Friedl.
This commit is contained in:
parent
fff395d75c
commit
1d011a3ec0
1 changed files with 46 additions and 0 deletions
46
src/cmd/9term/OpenBSD.c
Normal file
46
src/cmd/9term/OpenBSD.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include <u.h>
|
||||
#include "9term.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <sys/termios.h>
|
||||
#include <util.h>
|
||||
#include <libc.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in a new issue