ckcpro.c

来自「操作系统源代码」· C语言 代码 · 共 427 行 · 第 1/2 页

C
427
字号
case 33:    { srvptr = srvcmd;		    	 /* Got ACK to F */	    decode(rdatap,putsrv); putsrv('\0');	    if (*srvcmd) tlog(F110," stored as",srvcmd,0);	    if (sdata() < 0) { clsif(); seof(""); BEGIN sseof; }    	    	else BEGIN ssdata; }    break;case 34:    { if (canned(rdatap)) { clsif(); seof("D"); BEGIN sseof; }	    	else if (sdata() < 0) { clsif(); seof(""); BEGIN sseof; } }    break;case 35:    { if (gnfile() > 0) {		/* Got ACK to EOF, get next file */		if (sfile(xflg)) BEGIN ssdata;		else { errpkt("Can't open file") ; RESUME; }	    } else {			/* If no next file, EOT */		tsecs = gtimer();		seot();		BEGIN sseot; }	  }    break;case 36:    { RESUME; }    break;case 37:    { ermsg(rdatap);			/* Error packet, issue message. */    x = quiet; quiet = 1;		/* Close files silently, */    clsif(); clsof(1);			/* discarding any output file. */    tsecs = gtimer();    quiet = x;    if (backgrd && !server) fatal("Protocol error");    RESUME; }    break;case 38:    { errpkt("Unknown packet type"); RESUME; }    break;	    }    }}int tbl[] = {-1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 10, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  9, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 29, 38, 38, 37, 27, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 28, 38, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 30, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 31, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 32, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 33, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 34, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 35, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 36, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, -1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 13, 15, 12, 15, 15, 15, 15, 15, 15, 15, 15, 11,  8, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  7, 15,  4, 15, 15, 15,  5, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  3,  1, 15, 15,  2, 15,  6, 15, 15, 15, 15, 15, 15, 15, -1, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 16, 17, 18, 19, 25, 21, 25, 25, 25, 20, 25, 25, 25, 25, 25, 25, 25, 22, 23, 25, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25,  7, 25,  4, 25, 25, 25,  5, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,  3,  1, 25, 25,  2, 25,  6, 25, 25, 25, 25, 25, 25, 25, -1, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  8, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38,  0, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 27, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  8, 38, 38, 38, 38, 28, 26, 38, 38, 38, 38, 38, 38, 38,  7, 38,  4, 38, 38, 38,  5, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,  3,  1, 38, 38,  2, 38,  6, 38, 38, 38, 38, 38, 38, 38, };/*  P R O T O  --  Protocol entry function  */proto() {    extern int sigint();    int x;    conint(sigint);			/* Enable console interrupts *//* Set up the communication line for file transfer. */    if (local && (speed < 0)) {	screen(SCR_EM,0,0l,"Sorry, you must 'set speed' first");	return;    }    x = -1;    if (ttopen(ttname,&x,mdmtyp) < 0) {	debug(F111,"failed: proto ttopen local",ttname,local);	screen(SCR_EM,0,0l,"Can't open line");	return;    }    if (x > -1) local = x;    debug(F111,"proto ttopen local",ttname,local);    x = (local) ? speed : -1;    if (ttpkt(x,flow,parity) < 0) {	/* Put line in packet mode, */	screen(SCR_EM,0,0l,"Can't condition line");	return;    }    if (sstate == 'x') {		/* If entering server mode, */	server = 1;			/* set flag, */	if (!quiet) {	    if (!local)			/* and issue appropriate message. */	    	conol(srvtxt);	    else {	    	conol("Entering server mode on ");		conoll(ttname);	    }	}    } else server = 0;    if (sstate == 'v' && !local && !quiet)      conoll("Escape back to your local system and give a SEND command...");    if (sstate == 's' && !local && !quiet)      conoll("Escape back to your local system and give a RECEIVE command...");    sleep(1);/* The 'wart()' function is generated by the wart program.  It gets a character from the input() routine and then based on that character and the current state, selects the appropriate action, according to the state table above, which is transformed by the wart program into a big case statement.  The function is active for one transaction.*/    wart();				/* Enter the state table switcher. */        if (server) {			/* Back from packet protocol. */	server = 0;    	if (!quiet)  			/* Give appropriate message */	    conoll("C-Kermit server done");    }    ttres();    screen(SCR_TC,0,0l,"");		/* Transaction complete */}

⌨️ 快捷键说明

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