📄 ckuus7.c
字号:
case XYLEN: y = cmnum("Maximum number of characters in a packet","90",10,&x, xxstring); if (xx == XYRECV) { /* Receive... */ if ((y = setnum(&z,x,y,maxrps)) < 0) return(y); if (z < 10) { printf("Sorry, 10 is the minimum\n"); return(-9); } if (rmsflg) { tp = tmpbuf; sprintf(tp,"%d",z); sstate = setgen('S', "401", tp, ""); return((int) sstate); } else { if (z > MAXRP) z = MAXRP; y = adjpkl(z,wslotr,bigrbsiz); if (y != z) { urpsiz = y; if (#ifndef NOSPL cmdlvl == 0#else tlevel < 0#endif /* NOSPL */ ) if (msgflg) printf(" Adjusting receive packet-length to %d for %d window slots\n", y, wslotr); } urpsiz = y; rpsiz = (y > 94) ? 94 : y; } } else { /* Send... */ if ((y = setnum(&z,x,y,maxsps)) < 0) return(y); if (z < 10) { printf("Sorry, 10 is the minimum\n"); return(-9); } if (z > MAXSP) z = MAXSP; spsiz = z; /* Set it */ y = adjpkl(spsiz,wslotr,bigsbsiz); if (y != spsiz &&#ifndef NOSPL cmdlvl == 0#else tlevel < 0#endif /* NOSPL */ ) if (msgflg) printf("Adjusting packet size to %d for %d window slots\n", y,wslotr); spsiz = spmax = spsizr = y; /* Set it and flag that it was set */ spsizf = 1; /* to allow overriding Send-Init. */ } if (pflag &&#ifndef NOSPL cmdlvl == 0#else tlevel < 0#endif /* NOSPL */ ) { if (z > 94 && msgflg) { printf("Extended-length packets requested.\n"); if (bctr < 2 && z > 200) printf("\Remember to SET BLOCK 2 or 3 for long packets.\n"); } if (speed <= 0L) speed = ttgspd();#ifdef COMMENT/* Kermit does this now itself.*/ if (speed <= 0L && z > 200 && msgflg) { printf("\Make sure your timeout interval is long enough for %d-byte packets.\n",z); }#endif /* COMMENT */ } return(success = y); case XYMARK: y = cmnum("Code for packet-start character","1",10,&x,xxstring);#ifdef UNIX/* Printable start-of-packet works for UNIX and VMS only!*/ if ((y = setnum(&z,x,y,126)) < 0) return(y);#else#ifdef VMS if ((y = setnum(&z,x,y,126)) < 0) return(y);#else if ((y = setcc(&z,x,y)) < 0) return(y);#endif /* VMS */#endif /* UNIX */ if (xx == XYRECV) stchr = z; else mystch = z; return(success = y); case XYNPAD: /* PADDING */ y = cmnum("How many padding characters for inbound packets","0",10,&x, xxstring); if ((y = setnum(&z,x,y,94)) < 0) return(y); if (xx == XYRECV) mypadn = z; else npad = z; return(success = y); case XYPADC: /* PAD-CHARACTER */ y = cmnum("Decimal ASCII code for packet padding character","0",10,&x, xxstring); if ((y = setcc(&z,x,y)) < 0) return(y); if (xx == XYRECV) mypadc = z; else padch = z; return(success = y); case XYTIMO: /* TIMEOUT */ if (xx == XYRECV) { char buf[16]; /* Construct default */ sprintf(buf,"%d",URTIME); y = cmnum("Packet timeout interval",buf,10,&x,xxstring); if ((y = setnum(&z,x,y,94)) < 0) return(y); if (rmsflg) { /* REMOTE SET RECEIVE TIMEOUT */ tp = tmpbuf; /* Tell Kermit server what */ sprintf(tp,"%d",z); /* timeout to ask me to use. */ sstate = setgen('S', "402", tp, ""); return((int) sstate); } else { /* SET RECEIVE TIMEOUT */ pkttim = z; /* Value to put in my negotiation */ } /* packet for other Kermit to use */ } else { /* SET SEND TIMEOUT */ y = cmnum("Packet timeout interval","",10,&x,xxstring); if (y == -3) { /* They cancelled a previous */ x = DMYTIM; /* SET SEND command, so restore */ y = 0; /* the default */ timef = 0; /* and turn off the override flag */ } else { /* They gave a number */ timef = 1; /* so turn on the override flag */ } if ((y = setnum(&z,x,y,94)) < 0) return(y); timint = rtimo = z; /* Override value for me to use */ } return(success = 1); default: return(-2); } /* End of SET SEND/RECEIVE... */}#ifndef NOXMITintsetxmit() { if ((y = cmkey(xmitab,nxmit,"","",xxstring)) < 0) return(y); switch (y) { case XMITE: /* EOF */ y = cmtxt("Characters to send at end of file,\n\ Use backslash codes for control characters","",&s,xxstring); if (y < 0) return(y); if ((int)strlen(s) > XMBUFL) { printf("?Too many characters, %d maximum\n",XMBUFL); return(-2); } strcpy(xmitbuf,s); return(success = 1); case XMITF: /* Fill */ y = cmnum("Numeric code for blank-line fill character","0",10,&x, xxstring); if ((y = setnum(&z,x,y,127)) < 0) return(y); xmitf = z; return(success = 1); case XMITL: /* Linefeed */ return(success = seton(&xmitl)); case XMITS: /* Locking-Shift */ return(success = seton(&xmits)); case XMITP: /* Prompt */ y = cmnum("Numeric code for host's prompt character, 0 for none", "10",10,&x,xxstring); if ((y = setnum(&z,x,y,127)) < 0) return(y); xmitp = z; return(success = 1); case XMITX: /* Echo */ return(success = seton(&xmitx)); case XMITW: /* Pause */ y = cmnum("Number of milliseconds to pause between binary characters\n\or text lines during transmission","0",10,&x,xxstring); if ((y = setnum(&z,x,y,1000)) < 0) return(y); xmitw = z; return(success = 1); default: return(-2); }}#endif /* NOXMIT *//* D O R M T -- Do a remote command */ #ifdef ATTSV#ifndef aegis#ifndef datageneral#define CK_NEED_SIG#endif /* datageneral */#endif /* aegis */#endif /* ATTSV */VOID rmsg() { if (pflag) printf(#ifdef CK_NEEDSIG " Type your escape character, %s, followed by X or E to cancel.\n", dbchr(escape)#else " Press the X or E key to cancel.\n"#endif /* CK_NEEDSIG */ );}intdormt(xx) int xx; { int x, y, retcode; char *s, sbuf[50], *s2; if (xx < 0) return(xx); if (xx == XZSET) { /* REMOTE SET */ if ((y = cmkey(rmstab,nrms,"","",xxstring)) < 0) { if (y == -3) { printf("?Parameter name required\n"); return(-9); } else return(y); } return(doprm(y,1)); } switch (xx) { /* Others... */ case XZCWD: /* CWD */ if ((x = cmtxt("Remote directory name","",&s,xxstring)) < 0) return(x); debug(F111,"XZCWD: ",s,x); *sbuf = NUL; s2 = sbuf;/* The following is commented out, because there is practically no *//* computer in the world that requires a password for directory changing. *//* (The DEC-20 was the only one, and they're mostly all gone.) */#ifdef DIRPWDPR if (*s != NUL) { /* If directory name given, */ /* get password on separate line. */ if (tlevel > -1) { /* From take file... */ if (fgets(sbuf,50,tfile[tlevel]) == NULL) fatal("take file ends prematurely in 'remote cwd'"); debug(F110," pswd from take file",s2,0); for (x = (int)strlen(sbuf); x > 0 && (sbuf[x-1] == NL || sbuf[x-1] == CR); x--) sbuf[x-1] = '\0'; } else { /* From terminal... */ printf(" Password: "); /* get a password */#ifdef OS2 while (((x = isatty(0) ? coninc(0) : getchar()) != NL) && (x != CR)) { /* with no echo */#else while (((x = getchar()) != NL) && (x != CR)) { /* with no echo */#endif /* OS2 */ if ((x &= 0177) == '?') { printf("? Password of remote directory\n Password: "); s2 = sbuf; *sbuf = NUL; } else if (x == ESC) /* Mini command line editor... */ putchar(BEL); else if (x == BS || x == 0177) s2--; else if (x == 025) { /* Ctrl-U */ s2 = sbuf; *sbuf = NUL; } else *s2++ = x; } *s2 = NUL; putchar('\n'); } s2 = sbuf; } else s2 = "";#endif /* DIRPWDPR */ debug(F110," password",s2,0); sstate = setgen('C',s,s2,""); retcode = 0; break;case XZDEL: /* Delete */ if ((x = cmtxt("Name of remote file(s) to delete","",&s,xxstring)) < 0) { if (x == -3) { printf("?Name of remote file(s) required\n"); return(-9); } else return(x); } if (local) ttflui(); /* If local, flush tty input buffer */ retcode = sstate = rfilop(s,'E'); break; case XZDIR: /* Directory */ if ((x = cmtxt("Remote directory or file specification","",&s, xxstring)) < 0) return(x); if (local) ttflui(); /* If local, flush tty input buffer */ rmsg(); retcode = sstate = setgen('D',s,"",""); break; case XZHLP: /* Help */ if ((x = cmcfm()) < 0) return(x); sstate = setgen('H',"","",""); retcode = 0; break; #ifndef NOPUSHcase XZHOS: /* Host */ if ((x = cmtxt("Command for remote system","",&cmarg,xxstring)) < 0) return(x); if ((int)strlen(cmarg) < 1) { if (x == -3) { printf("?Remote host command required\n"); return(-9); } else return(x); } rmsg(); retcode = sstate = 'c'; break; #endif /* NOPUSH */#ifndef NOFRILLScase XZKER: if ((x = cmtxt("Command for remote Kermit","",&cmarg,xxstring)) < 0) return(x); if ((int)strlen(cmarg) < 1) { if (x == -3) { printf("?Remote Kermit command required\n"); return(-9); } else return(x); } retcode = sstate = 'k'; rmsg(); break; case XZLGI: { /* Login */ char *p1, *p2, *p3; if ((x = cmfld("User ID","",&s,xxstring)) < 0) return(x); if ((p1 = malloc((int)strlen(s) + 1)) == NULL) { printf("Internal error: malloc\n"); return(-2); } else strcpy(p1,s); if ((x = cmfld("Password","",&s,xxstring)) < 0) return(x); if ((p2 = malloc((int)strlen(s) + 1)) == NULL) { printf("Internal error: malloc\n"); return(-2); } else strcpy(p2,s); if ((x = cmtxt("Account or carriage return","", &s,xxstring)) < 0 && x != -3) return(x); if ((p3 = malloc((int)strlen(s) + 1)) == NULL) { printf("Internal error: malloc\n"); return(-2); } else strcpy(p3,s); sstate = setgen('I',p1,p2,p3); if (p3) free(p3); if (p2) free(p2); if (p1) free(p1); retcode = 0; break; }case XZLGO: /* Logout */ if ((x = cmcfm()) < 0) return(x); sstate = setgen('I',"","",""); retcode = 0; break; case XZPRI: /* Print */ if (!atdiso || !atcapr) { /* Disposition attribute off? */ printf("?Disposition Attribute is Off\n"); return(-2); } cmarg = ""; cmarg2 = ""; if ((x = cmifi("Local file(s) to print on remote printer","",&s,&y, xxstring)) < 0) { if (x == -3) { printf("?Name of local file(s) required\n"); return(-9); } return(x); } strcpy(line,s); /* Make a safe copy of filename */ *optbuf = NUL; /* Wipe out any old options */ if ((x = cmtxt("Options for remote print command","",&s,xxstring)) < 0) return(x); strcpy(optbuf,s); /* Make a safe copy of options */ if ((int)strlen(optbuf) > 94) { /* Make sure this is legal */ printf("?Option string too long\n"); return(-9); } nfils = -1; /* Expand file list internally */ cmarg = line; /* Point to file list. */ rprintf = 1; /* REMOTE PRINT modifier for SEND */ sstate = 's'; /* Set start state to SEND */ if (local) displa = 1; retcode = 0; break;#endif /* NOFRILLS */ case XZSPA: /* Space */ if ((x = cmtxt("Confirm, or remote directory name","",&s,xxstring)) < 0) return(x); retcode = sstate = setgen('U',s,"",""); break; #ifndef NOFRILLScase XZTYP: /* Type */ if ((x = cmtxt("Remote file specification","",&s,xxstring)) < 0) return(x); if ((int)strlen(s) < 1) { printf("?Remote filename required\n"); return(-9); } rmsg(); retcode = sstate = rfilop(s,'T'); break;#endif /* NOFRILLS */ #ifndef NOFRILLScase XZWHO: if ((x = cmtxt("Remote user name, or carriage return","",&s,xxstring)) < 0) return(x); retcode = sstate = setgen('W',s,"",""); break;#endif /* NOFRILLS */ default: if ((x = cmcfm()) < 0) return(x); printf("?Not implemented - %s\n",cmdbuf); return(-2); } if (local) ttflui(); /* If local, flush tty input buffer */ return(retcode);} /* R F I L O P -- Remote File Operation */ CHAR#ifdef CK_ANSICrfilop(char * s, char t)#elserfilop(s,t) char *s, t; #endif /* CK_ANSIC *//* rfilop */ { if (*s == NUL) { printf("?File specification required\n"); return((CHAR) 0); } debug(F111,"rfilop",s,t); return(setgen(t,s,"",""));}#ifdef SUNX25intsetx25() { if ((y = cmkey(x25tab,nx25,"X.25 call options","",xxstring)) < 0) return(y); switch (y) { case XYUDAT: if ((z = cmkey(onoff,2,"X.25 call user data","",xxstring)) < 0) return(z); if (z == 0) { if ((z = cmcfm()) < 0) return(z); cudata = 0; /* disable call user data */ return (success = 1); } if ((x = cmtxt("X.25 call user data string","",&s,xxstring)) < 0) return(x); if ((int)strlen(s) == 0) { return (-3); } else if ((int)strlen(s) > MAXCUDATA) { printf("?The length must be > 0 and <= %d\n",MAXCUDATA); return(-2); } if ((y = cmcfm()) < 0) return(y); strcpy(udata,s); cudata = 1; /* X.25 call user data specified */ return (success = 1); case XYCLOS: if ((z = cmkey(onoff,2,"X.25 closed user group call","",xxstring)) < 0) return(z); if (z == 0) { if ((z = cmcfm()) < 0) return(z); closgr = -1; /* disable closed user group */ return (success = 1); } if ((y = cmnum("0 <= cug index >= 99","",10,&x,xxstring)) < 0) return(y); if (x < 0 || x > 99) { printf("?The choices are 0 <= cug index >= 99\n"); return(-2); } if ((y = cmcfm()) < 0) return(y); closgr = x; /* closed user group selected */ return (success = 1); case XYREVC: if((z = cmkey(onoff,2,"X.25 reverse charge call","",xxstring)) < 0) return(z); if ((x = cmcfm()) < 0) return(x); revcall = z; return (success = 1); }}intsetpadp() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -