📄 pty.cc
字号:
#define _GNU_SOURCE#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <ioqueue.hh>#include <termios.h>#include "escc.hh"voidZilogESCC::setup_pty(void){ struct termios orig_termios; struct termios termios; io_fd = getpt(); if (io_fd == -1) { perror("getpt"); return; } if (grantpt(io_fd) == -1) { perror("grantpt"); return; } if (unlockpt(io_fd) == -1) { perror("unlockpt"); return; } msg("Channel B on %s", ptsname(io_fd)); if (tcgetattr(io_fd, &orig_termios) != -1) { termios = orig_termios; termios.c_iflag &= ~(INLCR|ICRNL); termios.c_lflag &= ~(ICANON|ECHO); tcsetattr(io_fd, TCSANOW, &termios); } ioqueue->insert(this);}voidZilogESCC::io_poll(){ int len; char c; len = ::read(io_fd, &c, 1); if (len > 0) input((int)c, ChannelB);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -