Blob
1 #include <u.h>2 #include <sys/types.h>3 #include <sys/ioctl.h>4 #include <termios.h>5 #include <sys/termios.h>6 #include <util.h>7 #include <libc.h>8 #include "term.h"10 int11 getpts(int fd[], char *slave)12 {13 return openpty(&fd[1], &fd[0], slave, 0, 0);14 }16 int17 childpty(int fd[], char *slave)18 {19 int sfd;21 close(fd[1]);22 setsid();23 sfd = open(slave, ORDWR);24 if(sfd < 0)25 sysfatal("open %s: %r\n", slave);26 if(ioctl(sfd, TIOCSCTTY, 0) < 0)27 fprint(2, "ioctl TIOCSCTTY: %r\n");28 return sfd;29 }31 struct winsize ows;33 void34 updatewinsize(int row, int col, int dx, int dy)35 {36 struct winsize ws;38 ws.ws_row = row;39 ws.ws_col = col;40 ws.ws_xpixel = dx;41 ws.ws_ypixel = dy;42 if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col)43 if(ioctl(rcfd[0], TIOCSWINSZ, &ws) < 0)44 fprint(2, "ioctl: %r\n");45 ows = ws;46 }48 int49 israw(int fd)50 {51 return 0;52 }54 int55 setecho(int fd, int on)56 {57 return 0;58 }