scrinit.c
来自「linux网络编程实例程序 socket程序 适合初学者。」· C语言 代码 · 共 51 行
C
51 行
/* scrinit.c - scrinit */#include <unistd.h>#include <termios.h>#include <string.h>#include <stdio.h>#include "telnet.h"#include "local.h"extern int scrindex;extern struct termios tntty;/*------------------------------------------------------------------------ * scrinit - initialize tty modes for script file collection *------------------------------------------------------------------------ */intscrinit(FILE *sfp, FILE *tfp, int c){ struct termios newtty; if (!doecho) { fprintf(tfp, "\nscripting requires remote ECHO.\n"); return -1; } if (scrfp) { fprintf(tfp,"\nalready scripting to \"%s\".\n", scrname); return -1; } scrindex = 0; if (tcgetattr(0, &tntty)) /* save current tty settings */ errexit("can't get tty modes: %s\n", strerror(errno)); newtty = oldtty; newtty.c_cc[VINTR] = _POSIX_VDISABLE; /* disable interrupt */ newtty.c_cc[VQUIT] = _POSIX_VDISABLE; /* disable interrupt */ newtty.c_cc[VSUSP] = _POSIX_VDISABLE; /* disable suspend */#ifdef VDSUSP newtty.c_cc[VDSUSP] = _POSIX_VDISABLE; /* disable suspend */#endif if (tcsetattr(0, TCSADRAIN, &newtty)) errexit("can't set tty modes: %s\n", strerror(errno)); fprintf(tfp, "\nscript file: "); (void) fflush(tfp); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?