8 #include <sys/termios.h>
20 "abcdefghijklmnopqrstuvwxyz"
21 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
25 "abcdefghijklmnopqrstuvwxyz"
26 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
29 getpts(int fd[], char *slave)
32 char pty[] = "/dev/ptyXX";
38 if((fd[1] = open(pty, ORDWR)) < 0){
45 if((fd[0] = open(slave, ORDWR)) >= 0)
55 childpty(int fd[], char *slave)
59 close(fd[1]); /* drop master */
61 sfd = open(slave, ORDWR);
63 sysfatal("child open %s: %r\n", slave);
64 if(ioctl(sfd, TIOCSCTTY, 0) < 0)
65 fprint(2, "ioctl TIOCSCTTY: %r\n");
72 updatewinsize(int row, int col, int dx, int dy)
80 needdisplay(); // in case this is 'win' and not 9term
81 // Leave "is this a hidpi display" in the low bit of the ypixel height for mc.
83 if(display != nil && display->dpi >= DefaultDPI*3/2)
87 if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col){
88 if(ioctl(rcfd, TIOCSWINSZ, &ws) < 0)
89 fprint(2, "ioctl: %r\n");
94 static struct termios ttmode;
99 if(tcgetattr(fd, &ttmode) < 0)
100 fprint(2, "tcgetattr: %r\n");
101 if(debug) fprint(2, "israw %c%c\n",
102 ttmode.c_lflag&ICANON ? 'c' : '-',
103 ttmode.c_lflag&ECHO ? 'e' : '-');
104 return ttmode.c_lflag&ECHO;
110 if(tcgetattr(fd, &ttmode) < 0)
112 return ttmode.c_cc[VINTR];