9 #include <sys/termios.h>
22 "abcdefghijklmnopqrstuvwxyz"
23 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
27 "abcdefghijklmnopqrstuvwxyz"
28 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
31 getpts(int fd[], char *slave)
34 char pty[] = "/dev/ptyXX";
40 if((fd[1] = open(pty, ORDWR)) < 0){
47 if((fd[0] = open(slave, ORDWR)) >= 0)
57 childpty(int fd[], char *slave)
61 close(fd[1]); /* drop master */
63 sfd = open(slave, ORDWR);
65 sysfatal("child open %s: %r\n", slave);
66 #if !defined (__AIX__)
67 if(ioctl(sfd, TIOCSCTTY, 0) < 0)
68 fprint(2, "ioctl TIOCSCTTY: %r\n");
76 updatewinsize(int row, int col, int dx, int dy)
84 needdisplay(); // in case this is 'win' and not 9term
85 // Leave "is this a hidpi display" in the low bit of the ypixel height for mc.
87 if(display != nil && display->dpi >= DefaultDPI*3/2)
91 if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col){
92 if(ioctl(rcfd, TIOCSWINSZ, &ws) < 0)
93 fprint(2, "ioctl: %r\n");
98 static struct termios ttmode;
103 if(tcgetattr(fd, &ttmode) < 0)
104 fprint(2, "tcgetattr: %r\n");
105 if(debug) fprint(2, "israw %c%c\n",
106 ttmode.c_lflag&ICANON ? 'c' : '-',
107 ttmode.c_lflag&ECHO ? 'e' : '-');
108 return ttmode.c_lflag&ECHO;
114 if(tcgetattr(fd, &ttmode) < 0)
116 return ttmode.c_cc[VINTR];