📄 ckuusr.c
字号:
return(success = dologin(s)); /* Return 1=completed, 0=failed */ }#endif /* NOSCRIPT */ if (cx == XXREC) { /* RECEIVE */ cmarg2 = ""; x = cmofi("Name under which to store the file, or CR","",&s, xxstring); if ((x == -1) || (x == -2)) return(x); if ((x = cmcfm()) < 0) return(x); strcpy(line,s); cmarg2 = line; debug(F111,"cmofi cmarg2",cmarg2,x); sstate = 'v';#ifdef MAC scrcreate();#endif /* MAC */ if (local) displa = 1; return(0); } if (cx == XXREM) { /* REMOTE */ x = cmkey(remcmd,nrmt,"Remote Kermit server command","",xxstring); if (x == -3) { printf("?You must specify a command for the remote server\n"); return(-9); } return(dormt(x)); }#ifndef NOFRILLS if (cx == XXREN) /* RENAME */ return(dorenam());#endif /* NOFRILLS */ if (cx == XXSEN || cx == XXMAI) { /* SEND, MAIL */ cmarg = cmarg2 = ""; if ((x = cmifi("File(s) to send","",&s,&y,xxstring)) < 0) { if (x == -3) { printf("?A file specification is required\n"); return(-9); } else return(x); } nfils = -1; /* Files come from internal list. */ strcpy(line,s); /* Save copy of string just parsed. */ strncpy(fspec,s,FSPECL); /* and here for \v(filespec) */ if (cx == XXSEN) { /* SEND command */ debug(F101,"Send: wild","",y); if (y == 0) { if ((x = cmtxt("Name to send it with","",&cmarg2, xxstring)) < 0) return(x); } else { if ((x = cmcfm()) < 0) return(x); } cmarg = line; /* File to send */ debug(F110,"Sending:",cmarg,0); if (*cmarg2 != '\0') debug(F110," as:",cmarg2,0); } else { /* MAIL */#ifndef NOFRILLS if (!atdiso || !atcapr) { /* Disposition attribute off? */ printf("?Disposition Attribute is Off\n"); return(-2); } debug(F101,"Mail: wild","",y); *optbuf = NUL; /* Wipe out any old options */ if ((x = cmtxt("Address to mail to","",&s,xxstring)) < 0) return(x); if ((int)strlen(s) == 0) { printf("?Address required\n"); return(-9); } strcpy(optbuf,s); if ((int)strlen(optbuf) > 94) { /* Ensure legal size */ printf("?Option string too long\n"); return(-2); } cmarg = line; /* File to send */ debug(F110,"Mailing:",cmarg,0); debug(F110,"To:",optbuf,0); rmailf = 1; /* MAIL modifier flag for SEND */#else printf("?Sorry, MAIL feature not configured.\n"); return(-2);#endif /* NOFRILLS */ } sstate = 's'; /* Set start state to SEND */#ifdef MAC scrcreate();#endif /* MAC */ if (local) { /* If in local mode, */ displa = 1; /* turn on file transfer display */#ifdef COMMENT/* Redundant -- this is done later in sipkt() */ ttflui(); /* and flush tty input buffer. */#endif /* COMMENT */ } return(0); } #ifndef NOMSEND if (cx == XXMSE) { /* MSEND command */ nfils = 0; /* Like getting a list of */ lp = line; /* files on the command line */ while (1) { char *p; if ((x = cmifi("Names of files to send, separated by spaces","", &s,&y,xxstring)) < 0) { if (x == -3) { if (nfils <= 0) { printf("?A file specification is required\n"); return(-9); } else break; } return(x); } msfiles[nfils++] = lp; /* Got one, count it, point to it, */ p = lp; /* remember pointer, */ while (*lp++ = *s++) ; /* and copy it into buffer */ debug(F111,"msfiles",msfiles[nfils-1],nfils-1); if (nfils == 1) *fspec = NUL; /* Take care of \v(filespec) */ if (((int)strlen(fspec) + (int)strlen(p) + 1) < FSPECL) { strcat(fspec,p); strcat(fspec," "); } } cmlist = msfiles; /* Point cmlist to pointer array */ cmarg2 = ""; /* No internal expansion list (yet) */ sndsrc = nfils; /* Filenames come from cmlist */ sstate = 's'; /* Set start state to SEND */#ifdef MAC scrcreate();#endif /* MAC */ if (local) { /* If in local mode, */ displa = 1; /* turn on file transfer display */ ttflui(); /* and flush tty input buffer. */ } return(0); }#endif /* NOMSEND */#ifndef NOSERVER if (cx == XXSER) { /* SERVER */ if ((x = cmcfm()) < 0) return(x); sstate = 'x';#ifdef MAC scrcreate();#endif /* MAC */ if (local) displa = 1;#ifdef AMIGA reqoff(); /* No DOS requestors while server */#endif /* AMIGA */ return(0); }#endif /* NOSERVER */ if (cx == XXSET) { /* SET command */ x = cmkey(prmtab,nprm,"Parameter","",xxstring); if (x == -3) { printf("?You must specify a parameter to set\n"); return(-9); } if (x < 0) return(x); /* have to set success separately for each item in doprm()... */ /* actually not really, could have just had doprm return 0 or 1 */ /* and set success here... */ y = doprm(x,0); if (y == -3) { printf("?More fields required\n"); return(-9); } else return(y); }#ifndef NOPUSH if (cx == XXSHE) { /* SHELL (system) command */ if (cmtxt("System command to execute","",&s,xxstring) < 0) return(-1); conres(); /* Make console normal */ x = zshcmd(s); concb((char)escape); return(success = x); }#endif /* NOPUSH */#ifndef NOSHOW if (cx == XXSHO) { /* SHOW */ x = cmkey(shotab,nsho,"","parameters",xxstring); if (x < 0) return(x); return(doshow(x)); }#endif /* NOSHOW */ #ifndef MAC if (cx == XXSPA) { /* SPACE */#ifdef datageneral /* AOS/VS can take an argument after its "space" command. */ if ((x = cmtxt("Confirm, or local directory name","",&s,xxstring)) < 0) return(x); if (*s == NUL) xsystem(SPACMD); else { sprintf(line,"space %s",s); xsystem(line); }#else#ifdef OS2 if ((x = cmtxt("Press Enter for current disk,\n\ or specify a disk letter like A:","",&s,xxstring)) < 0) return(x); if (*s == NUL) { /* Current disk */ printf(" Free space: %ldK\n", zdskspace(0)/1024L); } else { int drive = toupper(*s); printf(" Drive %c: %ldK free\n", drive, zdskspace(drive - 'A' + 1) / 1024L); }#else#ifdef UNIX#ifdef COMMENT if ((x = cmtxt("Confirm for current disk,\n\ or specify a disk device or directory","",&s,xxstring)) < 0) return(x);#else x = cmdir("Confirm for current disk,\n\ or specify a disk device or directory","",&s,xxstring); if (x == -3) s = ""; else if (x < 0) return(x); if ((x = cmcfm()) < 0) return(x);#endif /* COMMENT */ if (*s == NUL) { /* Current disk */ xsystem(SPACMD); } else { /* Specified disk */ sprintf(line,"%s %s",SPACM2,s); xsystem(line); }#else if ((x = cmcfm()) < 0) return(x); xsystem(SPACMD);#endif /* UNIX */#endif /* OS2 */#endif /* datageneral */ return(success = 1); /* Pretend it worked */ }#endif /* MAC */ if (cx == XXSTA) { /* STATISTICS */ if ((x = cmcfm()) < 0) return(x); return(success = dostat()); } if (cx == XXSTO || cx == XXEND) { /* STOP, END, or POP */ if ((y = cmnum("exit status code","0",10,&x,xxstring)) < 0) return(y); if ((y = cmtxt("Message to print","",&s,xxstring)) < 0) return(y); if (*s == '{') { /* Strip any enclosing braces */ x = (int)strlen(s); if (s[x-1] == '}') { s[x-1] = NUL; s++; } } if (*s) printf("%s\n",s); if (cx == XXSTO) dostop(); else popclvl(); return(success = (x == 0)); } if (cx == XXSUS) { /* SUSPEND */ if ((y = cmcfm()) < 0) return(y);#ifdef NOJC printf("Sorry, this version of Kermit cannot be suspended\n");#else stptrap(0);#endif /* NOJC */ return(0); } if (cx == XXTAK) { /* TAKE */ if (tlevel > MAXTAKE-1) { printf("?Take files nested too deeply\n"); return(-2); } if ((y = cmifi("C-Kermit command file","",&s,&x,xxstring)) < 0) { if (y == -3) { printf("?A file name is required\n"); return(-9); } else return(y); } if (x != 0) { printf("?Wildcards not allowed in command file name\n"); return(-9); } strcpy(line,s); if ((y = cmcfm()) < 0) return(y); return(success = dotake(line)); } #ifdef NETCONN if (cx == XXTEL) { /* TELNET */ if ((y = setlin(XYHOST,0)) < 0) return(y); return (success = (y == 0) ? 0 : doconect()); }#endif /* NETCONN */#ifndef NOXMIT if (cx == XXTRA) { /* TRANSMIT */ if ((x = cmifi("File to transmit","",&s,&y,xxstring)) < 0) { if (x == -3) { printf("?Name of an existing file\n"); return(-9); } else return(x); } if (y != 0) { printf("?Only a single file may be transmitted\n"); return(-2); } strcpy(line,s); /* Save copy of string just parsed. */ if ((y = cmcfm()) < 0) return(y); /* Confirm the command */ debug(F111,"calling transmit",line,xmitp); return(success = transmit(line,(char)xmitp)); /* Do the command */ }#endif /* NOXMIT */#ifndef NOFRILLS if (cx == XXTYP) { /* TYPE */#ifndef MAC char *tc;#endif /* MAC */ if ((x = cmifi("File to type","",&s,&y,xxstring)) < 0) { if (x == -3) { printf("?Name of an existing file\n"); return(-9); } else return(x); } if (y != 0) { printf("?A single file please\n"); return(-2); }#ifndef MAC if (!(tc = getenv("CK_TYPE"))) tc = TYPCMD; sprintf(line,"%s %s",tc,s); if ((y = cmcfm()) < 0) return(y); /* Confirm the command */ xsystem(line); return(success = 1);#else strcpy(line,s); if ((y = cmcfm()) < 0) return(y); /* Confirm the command */ return(success = dotype(line));#endif /* MAC */ }#endif /* NOFRILLS */#ifndef NOFRILLS if (cx == XXTES) { /* TEST */ /* Fill this in with whatever is being tested... */ if ((y = cmcfm()) < 0) return(y); /* Confirm the command */#ifndef NOSPL#ifdef COMMENT { int d, i, j; /* Dump all arrays */ char c, **p; for (i = 0; i < 27; i++) { p = a_ptr[i]; d = a_dim[i]; c = (i == 0) ? 64 : i + 96; if (d && p) { fprintf(stderr,"&%c[%d]\n",c,d); for (j = 0; j <= d; j++) { if (p[j]) { fprintf(stderr," &%c[%2d] = [%s]\n",c,j,p[j]); } } } } }#else /* Not COMMENT */ printf("cmdlvl = %d, tlevel = %d, maclvl = %d\n",cmdlvl,tlevel,maclvl); if (maclvl < 0) { printf("%s\n", "Call me from inside a macro and I'll dump the argument stack"); return(0); } printf("Macro level: %d, ARGC = %d\n ",maclvl,macargc[maclvl]); for (y = 0; y < 10; y++) printf("%7d",y); for (x = 0; x <= maclvl; x++) { printf("\n%2d: ",x); for (y = 0; y < 10; y++) { s = m_arg[x][y]; printf("%7s",s ? s : "(none)"); } } printf("\n");#endif /* COMMENT */#endif /* NOSPL */ return(0); }#endif /* NOFRILLS */#ifndef NOCSETS if (cx == XXXLA) { /* TRANSLATE <ifn> from-cs to-cs <ofn> */ int incs, outcs; if ((x = cmifi("File to translate","",&s,&y,xxstring)) < 0) { if (x == -3) { printf("?Name of an existing file\n"); return(-9); } else return(x); } if (y != 0) { printf("?A single file please\n"); return(-2); } strcpy(line,s); /* Save copy of string just parsed. */ if ((incs = cmkey(fcstab,nfilc,"from character-set","",xxstring)) < 0) return(incs); if ((outcs = cmkey(fcstab,nfilc,"to character-set","",xxstring)) < 0) return(outcs); if ((x = cmofi("output file",CTTNAM,&s,xxstring)) < 0) return(x); strncpy(tmpbuf,s,50); if ((y = cmcfm()) < 0) return(y); /* Confirm the command */ return(success = xlate(line,tmpbuf,incs,outcs)); /* Execute it */ }#endif /* NOCSETS */ if (cx == XXVER) { /* VERSION */ if ((y = cmcfm()) < 0) return(y); printf("%s,%s\n Numeric: %ld",versio,ckxsys,vernum); if (verwho) printf("-%d\n",verwho); else printf("\n"); return(success = 1); }#ifndef MAC#ifndef NOFRILLS if (cx == XXWHO) { /* WHO */ char *wc;#ifdef datageneral xsystem(WHOCMD);#else if ((y = cmtxt("user name","",&s,xxstring)) < 0) return(y); if (!(wc = getenv("CK_WHO"))) wc = WHOCMD; sprintf(line,"%s %s",wc,s); xsystem(line);#endif /* datageneral */ return(success = 1); }#endif /* NOFRILLS */#endif /* MAC */#ifndef NOFRILLS if (cx == XXWRI) { /* WRITE */ if ((x = cmkey(writab,nwri,"to file or log","",xxstring)) < 0) { if (x == -3) printf("?Write to what?\n"); return(x); } if ((y = cmtxt("text","",&s,xxstring)) < 0) return(y); if (*s == '{') { /* Strip enclosing braces */ y = (int)strlen(s); if (s[y-1] == '}') { s[y-1] = NUL; s++; } } switch (x) { case LOGD: y = ZDFILE; break; case LOGP: y = ZPFILE; break; case LOGS: y = ZSFILE; break; case LOGT: y = ZTFILE; break;#ifndef NOSPL case LOGW: y = ZWFILE; break;#endif /* NOSPL */ case LOGX: case LOGE:#ifndef MAC if (x == LOGE) fprintf(stderr,"%s",s); else#endif /* MAC */ printf("%s",s); if (#ifndef NOSPL cmdlvl == 0#else tlevel == -1#endif /* NOSPL */ )#ifndef MAC if (x == LOGE) fprintf(stderr,"\n"); else#endif /* MAC */ printf("\n"); return(success = 1); default: return(-2); } if ((x = zsout(y,s)) < 0) printf("?File or log not open\n"); return(success = (x == 0) ? 1 : 0); }#endif /* NOFRILLS */ debug(F101,"docmd unk arg","",cx); return(-2); /* None of the above. */} /* end of docmnd() */#endif /* NOICP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -