📄 ckuus3.c
字号:
if ((y = cmkey(dbgtab,ndbg,"","",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); switch (y) { case 0: /* 0 = all debugging off. */ debses = 0;#ifdef DEBUG if (deblog) doclslog(LOGD);#endif /* DEBUG */ return(success = 1); case 1: /* 1 = log debugging to debug.log */#ifdef DEBUG deblog = debopn("debug.log", 0); return(success = deblog ? 1 : 0);#else printf("?Sorry, debug log feature not enabled\n"); return(success = 0);#endif /* DEBUG */ case 2: /* 2 = session. */ return(success = debses = 1); }case XYDELA: /* SET DELAY */ y = cmnum("Number of seconds before starting to send","5",10,&x,xxstring); if (x < 0) x = 0; return(success = setnum(&delay,x,y,999));default: break;}switch (xx) { #ifndef NODIALcase XYDIAL: /* SET DIAL */ return(setdial());#endif /* NODIAL */#ifdef COMMENT /* Unused at present */case XYDOUB: if ((x = cmfld("Character to double","none",&s,xxstring)) < 0) { if (x == -3) { dblchar = -1; if (msgflg) printf("Doubling Off\n"); return(success = 1); } else return(x); } strcpy(line,s); lp = line; if ((x = cmcfm()) < 0) return(x); if (!xxstrcmp(lp,"none",4)) { dblchar = -1; if (msgflg) printf("Doubling Off\n"); return(success = 1); } if ((int)strlen(lp) != 1) return(-2); dblchar = *lp & 0xFF; if (msgflg) printf("Doubled: %d\n",dblchar); return(success = 1);#endif /* COMMENT */case XYDUPL: /* SET DUPLEX */ if ((y = cmkey(dpxtab,2,"","full",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); duplex = y; return(success = 1); case XYLCLE: /* LOCAL-ECHO (= DUPLEX) */ return(success = seton(&duplex));case XYESC: /* SET ESCAPE */ sprintf(tmpbuf,"%d",DFESC); y = cmnum("Decimal ASCII code for CONNECT-mode escape character", tmpbuf, 10,&x,xxstring); success = setcc(&escape,x,y);#ifdef COMMENT/* This is what SHOW ESCAPE is for. */ if (success && msgflg) printf(" CONNECT-mode escape character: %d (Ctrl-%c, %s)\n", escape,ctl(escape),(escape == 127 ? "DEL" : ccntab[escape]));#endif /* COMMENT */ return(success);default: break;}switch (xx) {case XYFILE: /* SET FILE */ return(setfil(rmsflg));case XYFLOW: /* FLOW-CONTROL *//* Note: flotab[] keyword table (defined above) only includes the legal flow-control options for each implementation, controlled by symbols defined in ckcdeb.h.*/ if ((y = cmkey(flotab,nflo,"","xon/xoff",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); flow = y; debug(F101,"set flow","",flow); return(success = 1); case XYHAND: /* HANDSHAKE */ if ((y = cmkey(hshtab,nhsh,"","none",xxstring)) < 0) return(y); if (y == 998) { if ((x = cmnum("ASCII value","",10,&y,xxstring)) < 0) return(x); if ((y < 1) || ((y > 31) && (y != 127))) { printf("?Character must be in ASCII control range\n"); return(-9); } } if ((x = cmcfm()) < 0) return(x); turn = (y > 0127) ? 0 : 1 ; turnch = y; return(success = 1); #ifndef NOSPLcase XYMACR: /* SET MACRO */ if ((y = cmkey(smactab,2,"","",xxstring)) < 0) return(y); switch (y) { case 0: return(success = seton(&mecho)); case 1: return(success = seton(&merror)); default: return(-2); }#endif /* NOSPL */#ifndef NODIALcase XYMODM: /* SET MODEM */ if ((x = cmkey(mdmtab,nmdm,"type of modem","none", xxstring)) < 0) return(x); if ((z = cmcfm()) < 0) return(z); mdmtyp = x;#ifndef MINIDIAL tbmodel = 0; /* If it's a Telebit, we don't know the model yet */#endif /* MINIDIAL */ return(success = 1);#endif /* NODIAL */ case XYMSGS:#ifdef VMS if ((z = cmkey(onoff,2,"","",xxstring)) < 0) return(z); if ((y = cmcfm()) < 0) return(y); vms_msgs = z; printf("Sorry, SET MESSAGES not implemented yet\n"); return(success = 0);#endif /* VMS */default: break;}switch (xx) { case XYPARI: /* PARITY */ if ((y = cmkey(partab,npar,"","none",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); /* If parity not none, then we also want 8th-bit prefixing */ if (parity = y) ebqflg = 1; else ebqflg = 0; return(success = 1); #ifndef NOFRILLScase XYPROM: /* SET PROMPT *//* Note: xxstring not invoked here. Instead, it is invoked every time the prompt is issued. This allows the prompt string to contain variables that can change, like \v(dir), \v(time), etc.*/#ifdef MAC if ((x = cmtxt("Program's command prompt","Mac-Kermit>",&s,NULL)) < 0)#else if ((x = cmtxt("Program's command prompt","C-Kermit>",&s,NULL)) < 0)#endif /* MAC */ return(x); if (*s == '{') { /* Remove enclosing braces, if any */ x = (int)strlen(s); if (s[x-1] == '}') { s[x-1] = NUL; s++; } }#ifdef COMMENT/* Let's not do this any more -- we don't do it anywhere else.*/ else if (*s == '"') { /* For compatibility with pre-5A */ x = (int)strlen(s); if (s[x-1] == '"') { s[x-1] = NUL; s++; } }#endif /* COMMENT */ cmsetp(s); /* Set the prompt */ return(success = 1);#endif /* NOFRILLS */ case XYRETR: /* RETRY: per-packet retry limit */ y = cmnum("Maximum retries per packet","10",10,&x,xxstring); if (x < 0) x = 0; if ((x = setnum(&maxtry,x,y,999)) < 0) return(x); if (maxtry <= wslotr) { printf("?Retry limit must be greater than window size\n"); return(success = 0); } sprintf(tmpbuf,"%d",maxtry); if (rmsflg) { sstate = setgen('S', "403", tmpbuf, ""); return((int) sstate); } else return(success = x); #ifndef NOSERVERcase XYSERV: /* SET SERVER items */ if ((y = cmkey(srvtab,2,"","",xxstring)) < 0) return(y); switch (y) { case XYSERT: tp = tmpbuf; sprintf(tp,"%d",DSRVTIM); if ((y = cmnum("interval for server NAKs, 0 = none",tp,10,&x, xxstring)) < 0) return(y); if (x < 0) { printf("\n?Specify a positive number, or 0 for no server NAKs\n"); return(0); } if ((y = cmcfm()) < 0) return(y); sprintf(tp,"%d",x); if (rmsflg) { sstate = setgen('S', "404", tp, ""); return((int) sstate); } else { srvtim = x; /* Set the server timeout variable */ return(success = 1); } case XYSERD: /* SERVER DISPLAY */ return(success = seton(&srvdis)); /* ON or OFF... */ default: return(-2); }#endif /* NOSERVER */#ifdef UNIX#ifndef NOJCcase XYSUSP: /* SET SUSPEND */ seton(&suspend); /* on or off... */ return(success = 1);#endif /* NOJC */#endif /* UNIX */case XYTAKE: /* SET TAKE */ if ((y = cmkey(taktab,4,"","",xxstring)) < 0) return(y); switch (y) { case 0: return(success = seton(&techo)); case 1: return(success = seton(&terror)); case 2: techo = 0; return(success = 1); /* For compatibility with */ case 3: techo = 1; return(success = 1); /* MS-DOS Kermit */ default: return(-2); }#ifndef NOSCRIPTcase XYSCRI: /* SET SCRIPT */ if ((y = cmkey(scrtab,1,"","echo",xxstring)) < 0) return(y); switch (y) { case 0: return(success = seton(&secho)); default: return(-2); }#endif /* NOSCRIPT */default: break;}switch (xx) {case XYTERM: /* SET TERMINAL */ return(settrm());default: break;}switch (xx) {/* SET SEND/RECEIVE protocol parameters. */ case XYRECV:case XYSEND: return(setsr(xx,rmsflg)); #ifdef UNIXcase XYSESS: /* SESSION-LOG */ if ((x = cmkey(fttab,2,"type of file","text",xxstring)) < 0) return(x); if ((y = cmcfm()) < 0) return(y); sessft = x; return(success = 1);#endif /* UNIX */case XYSPEE: /* SET SPEED */ if (network) { printf("\n?Speed cannot be set for network connections\n"); return(success = 0); } lp = line; sprintf(lp,"Transmission rate for %s in bits per second",ttname); if ((x = cmkey(spdtab,nspd,line,"",xxstring)) < 0) { if (x == -3) printf("?value required\n"); return(x); } if ((y = cmcfm()) < 0) return(y); if (!local) { printf("?Sorry, you must SET LINE first\n"); return(success = 0); } zz = (long) x * 10L; if (zz == 70) zz = 75; /* (see spdtab[] def) */ if (ttsspd(x) < 0) { /* Call ttsspd with cps, not bps! */ printf("?Unsupported line speed - %ld\n",zz); return(success = 0); } else { speed = zz; if (pflag &&#ifndef NOSPL cmdlvl == 0#else tlevel < 0#endif /* NOSPL */ ) { if (speed == 8880) printf("%s, 75/1200 bps\n",ttname); else printf("%s, %ld bps\n",ttname,speed); } return(success = 1); } case XYXFER: /* SET TRANSFER */ if ((y = cmkey(tstab,nts,"","character-set",xxstring)) < 0) return(y);#ifndef NOCSETS if (y == 1) { /* character-set */ if ((y = cmkey(tcstab,ntcs,"","transparent",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); if (rmsflg) { sstate = setgen('S', "405", tcsinfo[y].designator, ""); return((int) sstate); } else { tslevel = (y == TC_TRANSP) ? 0 : 1; /* transfer syntax level */ tcharset = y; /* transfer character set */ return(success = 1); } } else#endif /* NOCSETS */ if (y == 2) { /* LOCKING-SHIFT options */ if ((y = cmkey(lstab,nls,"","on",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); lscapr = (y == 1) ? 1 : 0; /* ON: requested = 1 */ lscapu = (y == 2) ? 2 : 0; /* FORCED: used = 1 */ return(success = 1); } else return(-2);#ifndef NOXMIT case XYXMIT: /* SET TRANSMIT */ return(setxmit());#endif /* NOXMIT */#ifndef NOCSETS case XYUNCS: /* UNKNOWN-CHARACTER-SET */ if ((y = cmkey(ifdtab,2,"","discard",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); unkcs = y; return(success = 1);#endif /* NOCSETS */#ifdef UNIX case XYWILD: /* WILDCARD-EXPANSION */ if ((y = cmkey(wildtab,2,"who expands wildcards","kermit",xxstring)) < 0) return(y); if ((x = cmcfm()) < 0) return(x); wildxpand = y; return(success = 1);#endif /* UNIX */ case XYWIND: /* WINDOW-SLOTS */ y = cmnum("Number of sliding-window slots, 1 to 31","1",10,&x,xxstring); y = setnum(&z,x,y,31); if (y < 0) return(y); if (z < 1) z = 1;#ifdef COMMENT /* This is unreasonable */ if (maxtry < z) { printf("?Window slots must be less than retry limit\n"); return(success = 0); }#endif /* COMMENT */ if (rmsflg) { /* Set remote window size */ tp = tmpbuf; sprintf(tp,"%d",z); sstate = setgen('S', "406", tp, ""); return((int) sstate); } wslotr = z; /* Set local window size */ swcapr = (wslotr > 1) ? 1 : 0; /* Set window bit in capas word? */ if (wslotr > 1) { /* Window size > 1? */ y = adjpkl(urpsiz,wslotr,bigrbsiz); /* Maybe adjust packet size */ if (y != urpsiz) { /* Did it change? */ urpsiz = y; if (msgflg) printf(" Adjusting receive packet-length to %d for %d window slots\n", urpsiz, wslotr); } } return(success = 1);default: if ((x = cmcfm()) < 0) return(x); printf("Not working yet - %s\n",cmdbuf); return(success = 0); }}#endif /* NOICP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -