1 c22d8e65 2004-03-25 devnull #include <u.h>
2 21a17ff3 2003-11-25 devnull #include "9term.h"
3 c22d8e65 2004-03-25 devnull #include <sys/types.h>
4 8ad51794 2004-03-25 devnull #include <termios.h>
5 8ad51794 2004-03-25 devnull #include <sys/termios.h>
6 f1613419 2003-11-25 devnull #include <libutil.h>
7 c22d8e65 2004-03-25 devnull #include <libc.h>
10 8ad51794 2004-03-25 devnull getpts(int fd[], char *slave)
12 8ad51794 2004-03-25 devnull return openpty(&fd[1], &fd[0], slave, 0, 0);
16 8ad51794 2004-03-25 devnull childpty(int fd[], char *slave)
20 8ad51794 2004-03-25 devnull close(fd[1]);
21 8ad51794 2004-03-25 devnull setsid();
22 8ad51794 2004-03-25 devnull sfd = open(slave, ORDWR);
23 8ad51794 2004-03-25 devnull if(sfd < 0)
24 8ad51794 2004-03-25 devnull sysfatal("open %s: %r\n", slave);
25 8ad51794 2004-03-25 devnull if(ioctl(sfd, TIOCSCTTY, 0) < 0)
26 8ad51794 2004-03-25 devnull fprint(2, "ioctl TIOCSCTTY: %r\n");
27 8ad51794 2004-03-25 devnull return sfd;
30 8ad51794 2004-03-25 devnull struct winsize ows;
33 8ad51794 2004-03-25 devnull updatewinsize(int row, int col, int dx, int dy)
35 8ad51794 2004-03-25 devnull struct winsize ws;
37 8ad51794 2004-03-25 devnull ws.ws_row = row;
38 8ad51794 2004-03-25 devnull ws.ws_col = col;
39 8ad51794 2004-03-25 devnull ws.ws_xpixel = dx;
40 8ad51794 2004-03-25 devnull ws.ws_ypixel = dy;
41 8ad51794 2004-03-25 devnull if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col)
42 8ad51794 2004-03-25 devnull if(ioctl(rcfd[0], TIOCSWINSZ, &ws) < 0)
43 8ad51794 2004-03-25 devnull fprint(2, "ioctl: %r\n");
44 8ad51794 2004-03-25 devnull ows = ws;