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

📄 ckcpro.w

📁 linux终端仿真程序
💻 W
📖 第 1 页 / 共 4 页
字号:
#endif /* NOSERVER */}<serve>C {				/* Receive Host command */#ifndef NOSERVER    if (x_login && !x_logged) {	errpkt((CHAR *)"Login required");	SERVE;    } else      if (!ENABLED(en_hos)) {	errpkt((CHAR *)"REMOTE HOST disabled");	RESUME;    } else {	srvptr = srvcmd;		/* Point to command buffer */	decode(rdatap,putsrv,0);	/* Decode command packet into it */	putsrv(NUL);			/* Null-terminate */	nakstate = 0;			/* Now sending, not receiving */	if (syscmd((char *)srvcmd,"")) { /* Try to execute the command */	    what = W_REMO;		/* Doing a REMOTE command. */	    if (timint < 1)	      timint = chktimo(rtimo,timef); /* Switch to per-packet timer */	    BEGIN ssinit;		/* If OK, send back its output */	} else {			/* Otherwise */	    errpkt((CHAR *)"Can't do system command"); /* report error */	    RESUME;			/* & go back to server command wait */	}    }#endif /* NOSERVER */}<serve>q {				/* User typed Ctrl-C... */#ifndef NOSERVER    if (!ENABLED(en_fin)) {	errpkt((CHAR *)"QUIT disabled");	RESUME;    } else {	success = 0; QUIT;    }#endif /* NOSERVER */}<serve>N {				/* Server got a NAK in command-wait */#ifndef NOSERVER    errpkt((CHAR *)"Did you say RECEIVE instead of GET?");    RESUME;#endif /* NOSERVER */}<serve>. {				/* Any other command in this state */#ifndef NOSERVER    if (c != ('E' - SP) && c != ('Y' - SP)) /* except E and Y packets. */      errpkt((CHAR *)"Unimplemented server function");    /* If we answer an E with an E, we get an infinite loop. */    /* A Y (ACK) can show up here if we sent back a short-form reply to */    /* a G packet and it was echoed.  ACKs can be safely ignored here. */    RESUME;				/* Go back to server command wait. */#endif /* NOSERVER */}<generic>I {				/* Login/out */#ifndef NOSERVER    char f1[LOGINLEN+1], f2[LOGINLEN+1], f3[LOGINLEN+1];    CHAR *p;    int len, i;    f1[0] = NUL; f2[0] = NUL; f3[0] = NUL;    if (x_login) {			/* Login required */	len = 0;	if (srvcmd[1])			/* First length field */	  len = xunchar(srvcmd[1]);	/* Separate the parameters */	if (len > 0 && len <= LOGINLEN) { /* Have username */	    p = srvcmd + 2;		/* Point to it */	    for (i = 0; i < len; i++)	/* Copy it */	      f1[i] = p[i];	    f1[len] = NUL;		/* Terminate it */	    p += len;			/* Point to next length field */	    if (*p) {			/* If we have one */		len = xunchar(*p++);	/* decode it */		if (len > 0 && len <= LOGINLEN) {		    for (i = 0; i < len; i++) /* Same deal for password */		      f2[i] = p[i];		    f2[len] = NUL;		    p += len;		/* And account */		    if (*p) {			len = xunchar(*p++);				if (len > 0 && len <= LOGINLEN) {			    for (i = 0; i < len; i++)			      f3[i] = p[i];			    f3[len] = NUL;			}		    }		}	    }	}	debug(F110,"XXX user",f1,0);	debug(F110,"XXX pass",f2,0);	debug(F110,"XXX acct",f3,0);	if (!f1[0]) {	    if (x_logged) {		tlog(F110,"Logged out",x_user,0);		ack1((CHAR *)"Logged out");	    } else {		ack1((CHAR *)"You were not logged in");	    }	    x_logged = 0;	} else {	    x_logged = 0;	    if (x_user && x_passwd) {	/* Username and password must match */		if (!strcmp(x_user,f1))		  if (!strcmp(x_passwd,f2))		    x_logged = 1;	    } else if (x_user) {	/* Only username must match */		if (!strcmp(x_user,f1))		    x_logged = 1;	    }		  	    if (x_logged) {		tlog(F110,"Logged in", x_user, 0);		ack1((CHAR *)"Logged in");	    } else {		tlog(F110,"Login failed", f1, 0);		ack1((CHAR *)"Login failed");	    }	}    } else {	ack1((CHAR *)"No login required");    }    SERVE;#endif /* NOSERVER */}<generic>C {				/* Got REMOTE CD command */#ifndef NOSERVER    if (!ENABLED(en_cwd)) {	errpkt((CHAR *)"REMOTE CD disabled");	RESUME;    } else {	if (!cwd((char *)(srvcmd+1))) errpkt((CHAR *)"Can't change directory");	RESUME;				/* Back to server command wait */    }#endif /* NOSERVER */}<generic>A {				/* Got REMOTE PWD command */#ifndef NOSERVER    if (!ENABLED(en_cwd)) {	errpkt((CHAR *)"REMOTE CD disabled");	RESUME;    } else {	if (encstr((CHAR *)zgtdir()) > -1) /* Get & encode current directory */	  ack1(data);			/* If it fits, send it back in ACK */	RESUME;				/* Back to server command wait */    }#endif /* NOSERVER */}<generic>D {				/* REMOTE DIRECTORY command */#ifndef NOSERVER    char *n2;    if (!ENABLED(en_dir)) {		/* If DIR is disabled, */	errpkt((CHAR *)"REMOTE DIRECTORY disabled"); /* refuse. */	RESUME;    } else {				/* DIR is enabled. */	if (!ENABLED(en_cwd)) {		/* But CWD is disabled */	    zstrip((char *)(srvcmd+2),&n2); /* and they included a pathname, */	    if (strcmp((char *)(srvcmd+2),n2)) { /* so refuse. */		errpkt((CHAR *)"Access denied");		RESUME;			/* Remember, this is not a goto! */	    }	}		if (state == generic) {			/* It's OK to go ahead. */#ifdef COMMENT	    n2 = (*(srvcmd+2)) ? DIRCMD : DIRCM2;	    if (syscmd(n2,(char *)(srvcmd+2)))  /* If it can be done */#else	    if (snddir((char*)(srvcmd+2)))#endif /* COMMENT */    	      BEGIN ssinit;			/* send the results back */	    else {				/* otherwise */		errpkt((CHAR *)"Can't list directory"); /* report failure, */		RESUME;			/* return to server command wait */	    }	}    }#endif /* NOSERVER */}<generic>E {				/* REMOTE DELETE (Erase) command */#ifndef NOSERVER    char *n2;    if (!ENABLED(en_del)) {	errpkt((CHAR *)"REMOTE DELETE disabled");    	RESUME;    } else {				/* DELETE is enabled */	if (!ENABLED(en_cwd)) {		/* but CWD is disabled */	    zstrip((char *)(srvcmd+2),&n2); /* and they included a pathname, */	    if (strcmp((char *)(srvcmd+2),n2)) { /* so refuse. */		errpkt((CHAR *)"Access denied");		RESUME;			/* Remember, this is not a goto! */	    }	}		if (state == generic) {		/* It's OK to go ahead. */	    if (#ifdef COMMENT	    syscmd(DELCMD,(char *)(srvcmd+2)) /* Old way */#else	    snddel((char*)(srvcmd+2))	/* New way */#endif /* COMMENT */		)	      BEGIN ssinit;		/* If OK send results back */	    else {			/* otherwise */		errpkt((CHAR *)"Can't remove file"); /* report failure */		RESUME;			/* & return to server command wait */	    }	}    }#endif /* NOSERVER */}<generic>F {				/* FINISH */#ifndef NOSERVER    if (!ENABLED(en_fin)) {	errpkt((CHAR *)"FINISH disabled");    	RESUME;    } else {	ack();				/* Acknowledge */	screen(SCR_TC,0,0L,"");		/* Display */	return(0);			/* Done */    }#endif /* NOSERVER */}<generic>L {				/* BYE */#ifndef NOSERVER    if (!ENABLED(en_bye)) {	errpkt((CHAR *)"BYE disabled");    	RESUME;    } else {	ack();				/* Acknowledge */	ttres();			/* Reset the terminal */	screen(SCR_TC,0,0L,"");		/* Display */	doclean();			/* Clean up files, etc */#ifdef DEBUG	debug(F100,"C-Kermit BYE","",0);	zclose(ZDFILE);#endif /* DEBUG */	return(zkself());		/* Try to log self out */    }#endif /* NOSERVER */}<generic>H {				/* REMOTE HELP */#ifndef NOSERVER    extern char * hlptxt;    if (sndhlp(hlptxt)) BEGIN ssinit;	/* Try to send it */    else {				/* If not ok, */	errpkt((CHAR *)"Can't send help"); /* send error message instead */	RESUME;				/* and return to server command wait */    }#endif /* NOSERVER */}<generic>R {                            /* REMOTE RENAME */#ifndef NOSERVER#ifdef ZRENAME    char *str1, *str2, f1[256], f2[256];    int  len1, len2;    if (!ENABLED(en_ren)) {	errpkt((CHAR *)"REMOTE RENAME disabled");	RESUME;    } else {				/* RENAME is enabled */	int len1, len2;	len1 = xunchar(srvcmd[1]);	/* Separate the parameters */	len2 = xunchar(srvcmd[2+len1]);	strncpy(f1,(char *)(srvcmd+2),len1);	f1[len1] = NUL;	strncpy(f2,(char *)(srvcmd+3+len1),len2);	f2[len2] = NUL; 	len2 = xunchar(srvcmd[2+len1]);	strncpy(f1,(char *)(srvcmd+2),len1);	f1[len1] = NUL;	strncpy(f2,(char *)(srvcmd+3+len1),len2);	f2[len2] = NUL; 	    	if (!ENABLED(en_cwd)) {		/* If CWD is disabled */	    zstrip(f1,&str1);		/* and they included a pathname, */	    zstrip(f2,&str2);	    if ( strcmp(f1,str1) || strcmp(f2,str2) ) { /* refuse. */		errpkt((CHAR *)"Access denied");		RESUME;			/* Remember, this is not a goto! */	    }	}		if (state == generic) {		/* It's OK to go ahead. */	    if (zrename(f1,f2)) {	/* Try */ 		errpkt((CHAR *)"Can't rename file"); /* Give error msg */	    } else ack();	    RESUME;			/* Wait for next server command */	}    } #else /* no ZRENAME */    /* Give error message */    errpkt((CHAR *)"REMOTE RENAME not available");     RESUME;				/* Wait for next server command */#endif /* ZRENAME */#endif /* NOSERVER */}<generic>K {                            /* REMOTE COPY */#ifndef NOSERVER#ifdef ZCOPY    char *str1, *str2, f1[256], f2[256];    int  len1, len2;    if (!ENABLED(en_cpy)) {	errpkt((CHAR *)"REMOTE COPY disabled");	RESUME;    } else {        len1 = xunchar(srvcmd[1]);	/* Separate the parameters */        len2 = xunchar(srvcmd[2+len1]);        strncpy(f1,(char *)(srvcmd+2),len1);        f1[len1] = NUL;        strncpy(f2,(char *)(srvcmd+3+len1),len2);        f2[len2] = NUL; 	if (!ENABLED(en_cwd)) {		/* If CWD is disabled */	    zstrip(f1,&str1);		/* and they included a pathname, */            zstrip(f2,&str2);	    if (strcmp(f1,str1) || strcmp(f2,str2)) { /* Refuse. */		errpkt((CHAR *)"Access denied");		RESUME;			/* Remember, this is not a goto! */	    }	}		if (state == generic) {		/* It's OK to go ahead. */            if (zcopy(f1,f2)) {		/* Try */ 		errpkt((CHAR *)"Can't copy file"); /* give error message */	    } else ack();            RESUME;			/* wait for next server command */	}    }#else /* no ZCOPY */    errpkt((CHAR *)"REMOTE COPY not available"); /* give error message */    RESUME;				/* wait for next server command */#endif /* ZCOPY */#endif /* NOSERVER */}<generic>S {				/* REMOTE SET */#ifndef NOSERVER    if (!ENABLED(en_set)) {	errpkt((CHAR *)"REMOTE SET disabled");	RESUME;    } else {	if (remset((char *)(srvcmd+1)))	/* Try to do what they ask */	  ack();			/* If OK, then acknowledge */	else				/* Otherwise */	  errpkt((CHAR *)"Unknown REMOTE SET parameter"); /* give error msg */	RESUME;				/* Return to server command wait */    }#endif /* NOSERVER */}<generic>T {				/* REMOTE TYPE */#ifndef NOSERVER    char *n2;    if (!ENABLED(en_typ)) {	errpkt((CHAR *)"REMOTE TYPE disabled");	RESUME;    } else {	if (!ENABLED(en_cwd)) {		/* If CWD disabled */	    zstrip((char *)(srvcmd+2),&n2); /* and they included a pathname, */	    if (strcmp((char *)(srvcmd+2),n2)) { /* refuse. */		errpkt((CHAR *)"Access denied");		RESUME;			/* Remember, this is not a goto! */	    }	}		if (state == generic) {		/* It's OK to go ahead. */	    binary = XYFT_T;		/* Use text mode for this. */	    if (			/* (RESUME didn't change state) */#ifdef COMMENT	      syscmd(TYPCMD,(char *)(srvcmd+2))	/* Old way */#else	      sndtype((char *)(srvcmd+2)) /* New way */#endif /* COMMENT */		)	      BEGIN ssinit;			/* OK */	    else {				/* not OK */		errpkt((CHAR *)"Can't type file"); /* give error message */		RESUME;			/* wait for next server command */	    }	}    }#endif /* NOSERVER */}<generic>U {				/* REMOTE SPACE */#ifndef NOSERVER    if (!ENABLED(en_spa)) {	errpkt((CHAR *)"REMOTE SPACE disabled");	RESUME;    } else {	x = srvcmd[1];			/* Get area to check */	x = ((x == NUL) || (x == SP)#ifdef OS2	     || (x == '!') || (srvcmd[3] == ':')#endif /* OS2 */	     );	if (!x && !ENABLED(en_cwd)) {	/* CWD disabled */	    errpkt((CHAR *)"Access denied"); /* and non-default area given, */	    RESUME;			/* refuse. */	} else {#ifdef OS2_PROTOTYP(int sndspace,(int));	    if (sndspace(x ? toupper(srvcmd[2]) : 0))	      BEGIN ssinit;		/* Try to send it */	    else {			/* If not ok, */		errpkt((CHAR *)"Can't send space"); /* send error message */		RESUME;			/* and return to server command wait */	    }#else	    x = (x ? syscmd(SPACMD,"") : syscmd(SPACM2,(char *)(srvcmd+2)));	    if (x) {				/* If we got the info */		BEGIN ssinit;			/* send it */	    } else {				/* otherwise */		errpkt((CHAR *)"Can't check space"); /* send error message */		RESUME;			/* and await next server command */	    }#endif /* OS2 */	}    }#endif /* NOSERVER */}<generic>W {				/* REMOTE WHO */#ifndef NOSERVER    if (!ENABLED(en_who)) {	errpkt((CHAR *)"REMOTE WHO disabled");	RESUME;    } else {#ifdef OS2

⌨️ 快捷键说明

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