suspend.c
来自「comer s TCPIP-vol3源代码...当然是经典咯」· C语言 代码 · 共 33 行
C
33 行
/* suspend.c - */#include <sys/types.h>#include <sys/signal.h>#include <stdio.h>#include <string.h>#include "local.h"extern struct termios tntty;/*------------------------------------------------------------------------ * suspend - suspend execution temporarily *------------------------------------------------------------------------ */intsuspend(FILE *sfp, FILE *tfp, int c){ if (tcgetattr(0, &tntty) < 0) /* save current tty state */ errexit("can't get tty modes: %s\n", strerror(errno)); if (tcsetattr(0, TCSADRAIN, &oldtty) < 0) /* restore old state */ errexit("can't set tty modes: %s\n", strerror(errno)); (void) kill(0, SIGTSTP); if (tcgetattr(0, &oldtty) < 0) /* may have changed */ errexit("can't get tty modes: %s\n", strerror(errno)); if (tcsetattr(0, TCSADRAIN, &tntty) < 0) /* back to telne modes*/ errexit("can't set tty modes: %s\n", strerror(errno)); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?