⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pty.cc

📁 一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,
💻 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 + -