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

📄 pty_sgi.c

📁 支持ZModem, Telnet功能的串口通讯程序
💻 C
字号:
/* * This is an SGI specific version of the pty.c file which is * necessary because of the ugly way in which IRIX does it's * pty handling. For an explanation of what this function does * see pty_bsd.c */#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <fcntl.h>#include "virtmodem.h"voidattach_pty(int daemon){    char *ttname;    int fd;    ttname=_getpty(&fd, O_RDWR, 0644, 0);    if(!ttname) {	fprintf(stderr,"No free tty/pty pairs\n");	exit(1);    }    if(daemon) {		/* possibly fork */	if(fork()) {	    puts(ttname);	    exit(0);	}    } else	fprintf(stderr,"Running on terminal %s\n",ttname);    /* close terminal and dup descriptors */    fclose(stdin);    fclose(stdout);    fclose(stderr);    dup2(fd,0);    dup2(fd,1);    dup2(fd,2);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -