ttputc.c

来自「&#61599 Douglas Comer」· C语言 代码 · 共 66 行

C
66
字号
/* ttputc.c - ttputc */#include <sys/types.h>#include <stdio.h>#include "telnet.h"int	tcout(char *cap, FILE *tfp);int	xputc(char ch, FILE *fp);/*------------------------------------------------------------------------ * ttputc - print a single character on a Network Virtual Terminal *------------------------------------------------------------------------ */intttputc(FILE *sfp, FILE *tfp, int c){	static	last_char;	int	tc;	if (rcvbinary) { 		(void) xputc(c, tfp);	/* print uninterpretted	*/		return 0;	}	if (synching)			/* no data, if in SYNCH	*/		return 0;	if ((last_char == VPCR && c == VPLF) ||	    (last_char == VPLF && c == VPCR)) {		(void) xputc(VPLF, tfp);		last_char = 0;		return 0;	}	if (last_char == VPCR)		(void) tcout("cr", tfp);	else if (last_char == VPLF)		(void) tcout("do", tfp);	if (c >= ' ' && c < TCIAC)	/* printable ASCII	*/		(void) xputc(c, tfp);	else {				/* NVT special		*/		switch (c) {		case VPLF: 		/* see if CR follows	*/		case VPCR:	tc = 1;	/* see if LF follows	*/				break;		case VPBEL:	tc = tcout("bl", tfp);				break;		case VPBS:	tc = tcout("bc", tfp);				break;		case VPHT:	tc = tcout("ta", tfp);				break;		case VPVT:	tc = tcout("do", tfp);				break;		case VPFF:	tc = tcout("cl", tfp);				break;		default:			tc = 1;			break;	/* no action */		}		if (!tc)		/* if no termcap, assume ASCII */			(void) xputc(c, tfp);	}	last_char = c;	return 0;}

⌨️ 快捷键说明

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