📄 ckuus4.c
字号:
tr_int = 0; /* Have not been interrupted (yet). */ z = 1; /* Return code presumed good. */ tcs = gettcs(csin,csout); /* Get intermediate set. */ printf("%s (%s) => %s (%s)\n", /* Say what we're doing. */ fin, fcsinfo[csin].name, fout,fcsinfo[csout].name ); printf("via %s", tcsinfo[tcs].name); if (language) printf(", language: %s\n",langs[language].description); printf("\n\n"); if (csin == csout) { /* Input and output sets the same? */ sxx = rxx = NULL; /* If so, no translation. */ } else { /* Otherwise, set up */ sxx = xls[tcs][csin]; /* translation function */ rxx = xlr[tcs][csout]; /* pointers. */ if (rxx == zl1as) rxx = xl1as; } while ((c = zminchar()) != -1) { /* Loop for all characters in file */ if (tr_int) { /* Interrupted? */ printf("^C...\n"); /* Print message */ z = 0; break; } if (sxx) c = (*sxx)((CHAR)c); /* From fcs1 to tcs */ if (rxx) c = (*rxx)((CHAR)c); /* from tcs to fcs2 */ if (zchout(filecode,(char)c) < 0) { /* Output the xlated character */ printf("File output error\n"); z = 0; break; } }#ifndef AMIGA#ifndef MAC signal(SIGINT,oldsig); /* put old signal action back. */#endif /* MAC */#endif /* AMIGA */ tr_int = 0; zclose(ZIFILE); /* close files, */ zclose(filecode); return(z); /* and return successfully. */}#endif /* NOCSETS *//* D O L O G -- Do the log command */intdolog(x) int x; { int y, disp; char *s = NULL;#ifdef ZFNQFP struct zfnfp * fnp;#endif /* ZFNQFP */ switch (x) { /* Which log... */#ifdef DEBUG case LOGD: y = cmofi("Name of debugging log file","debug.log",&s,xxstring); break;#endif /* DEBUG */ case LOGP: y = cmofi("Name of packet log file","packet.log",&s,xxstring); break;#ifndef NOLOCAL case LOGS: y = cmofi("Name of session log file","session.log",&s,xxstring); break;#endif /* NOLOCAL */#ifdef TLOG case LOGT: y = cmofi("Name of transaction log file","transact.log",&s, xxstring); break;#endif /* TLOG */ default: printf("\n?Unknown log designator - %d\n",x); return(-2); } if (y < 0) return(y); if (y == 2) { printf("?Sorry, %s is a directory name\n",s); return(-9); }#ifdef ZFNQFP if (fnp = zfnqfp(s,TMPBUFSIZ - 1,tmpbuf)) { if (fnp->fpath) if ((int) strlen(fnp->fpath) > 0) s = fnp->fpath; }#endif /* ZFNQFP */ strcpy(line,s); s = line;#ifdef MAC y = 0;#else if ((y = cmkey(disptb,2,"Disposition","new",xxstring)) < 0) return(y);#endif /* MAC */ disp = y; if ((y = cmcfm()) < 0) return(y); switch (x) {#ifdef DEBUG case LOGD: return(deblog = debopn(s,disp));#endif /* DEBUG */ case LOGP: return(pktlog = pktopn(s,disp));#ifndef NOLOCAL case LOGS: return(seslog = sesopn(s,disp));#endif /* NOLOCAL */#ifdef TLOG case LOGT: return(tralog = traopn(s,disp));#endif /* TLOG */ default: return(-2); }}intpktopn(s,disp) char *s; int disp; { extern char pktfil[]; static struct filinfo xx; int y; zclose(ZPFILE); if(s[0] == '\0') return(0); if (disp) { xx.bs = 0; xx.cs = 0; xx.rl = 0; xx.org = 0; xx.cc = 0; xx.typ = 0; xx.dsp = XYFZ_A; xx.os_specific = '\0'; xx.lblopts = 0; pktlog = zopeno(ZPFILE,s,NULL,&xx); } else pktlog = zopeno(ZPFILE,s,NULL,NULL); if (pktlog > 0) strcpy(pktfil,s); else *pktfil = '\0'; return(pktlog);}inttraopn(s,disp) char *s; int disp; {#ifdef TLOG extern char trafil[]; static struct filinfo xx; int y; zclose(ZTFILE); if(s[0] == '\0') return(0); if (disp) { xx.bs = 0; xx.cs = 0; xx.rl = 0; xx.org = 0; xx.cc = 0; xx.typ = 0; xx.dsp = XYFZ_A; xx.os_specific = '\0'; xx.lblopts = 0; tralog = zopeno(ZTFILE,s,NULL,&xx); } else tralog = zopeno(ZTFILE,s,NULL,NULL); if (tralog > 0) { strcpy(trafil,s); tlog(F110,"Transaction Log:",versio,0L);#ifndef MAC tlog(F100,ckxsys,"",0L);#endif /* MAC */ ztime(&s); tlog(F100,s,"",0L); } else *trafil = '\0'; return(tralog);#else return(0);#endif /* TLOG */}#ifndef NOLOCALintsesopn(s,disp) char * s; int disp; { extern char sesfil[]; static struct filinfo xx; int y; zclose(ZSFILE); if(s[0] == '\0') return(0); if (disp) { xx.bs = 0; xx.cs = 0; xx.rl = 0; xx.org = 0; xx.cc = 0; xx.typ = 0; xx.dsp = XYFZ_A; xx.os_specific = '\0'; xx.lblopts = 0; seslog = zopeno(ZSFILE,s,NULL,&xx); } else seslog = zopeno(ZSFILE,s,NULL,NULL); if (seslog > 0) strcpy(sesfil,s); else *sesfil = '\0'; return(seslog);}#endif /* NOLOCAL */intdebopn(s,disp) char *s; int disp; {#ifdef DEBUG char *tp; static struct filinfo xx; zclose(ZDFILE); if (disp) { xx.bs = 0; xx.cs = 0; xx.rl = 0; xx.org = 0; xx.cc = 0; xx.typ = 0; xx.dsp = XYFZ_A; xx.os_specific = '\0'; xx.lblopts = 0; deblog = zopeno(ZDFILE,s,NULL,&xx); } else deblog = zopeno(ZDFILE,s,NULL,NULL); if (deblog > 0) { strcpy(debfil,s); debug(F110,"Debug Log ",versio,0);#ifndef MAC debug(F100,ckxsys,"",0);#endif /* MAC */ ztime(&tp); debug(F100,tp,"",0); } else *debfil = '\0'; return(deblog);#else return(0);#endif /* MAC */}/* G F M O D E -- Get File (transfer) Mode */char *gfmode(binary) int binary; { char * s; switch (binary) { case XYFT_T: s = "text"; break;#ifdef VMS case XYFT_B: s = "binary fixed"; break; case XYFT_I: s = "image"; break; case XYFT_L: s = "labeled"; break; case XYFT_U: s = "binary undef"; break;#else#ifdef MAC case XYFT_B: s = "binary"; break; case XYFT_M: s = "macbinary"; break;#else case XYFT_B: s = "binary"; break;#ifdef CK_LABELED case XYFT_L: s = "labeled"; break;#endif /* CK_LABELED */#endif /* MAC */#endif /* VMS */ default: s = ""; break; } return(s);}#ifndef NOSHOW/* S H O P A R -- Show Parameters */#ifdef ANYX25VOIDshox25() { if (nettype == NET_SX25) { printf("SunLink X.25 V%d.%d",x25ver / 10,x25ver % 10); if (ttnproto == NP_X3) printf(", PAD X.3, X.28, X.29 protocol,"); printf("\n Reverse charge call %s", revcall ? "selected" : "not selected"); printf (", Closed user group "); if (closgr > -1) printf ("%d",closgr); else printf ("not selected"); printf (","); printf("\n Call user data %s.\n", cudata ? udata : "not selected"); } else if (nettype == NET_VX25) { if (ttnproto == NP_X3) printf(", PAD X.3, X.28, X.29 protocol,"); printf("\n Reverse charge call %s", revcall ? "selected" : "not selected"); printf (", Closed user group [unsupported]"); if (closgr > -1) printf ("%d",closgr); else printf ("not selected"); printf (","); printf("\n Call user data %s.\n", cudata ? udata : "not selected"); }}#endif /* ANYX25 */VOIDshoparc() { int i; char *s; long zz; printf("Communications Parameters:\n"); if (network) { printf(" Host: %s",ttname); } else {#ifdef OS2 printf(" Port: %s, speed: ",ttname);#else printf(" Line: %s, speed: ",ttname);#endif /* OS2 */ if ((zz = ttgspd()) < 0) { printf("unknown"); } else { if (speed == 8880) printf("75/1200"); else printf("%ld",zz); } } printf(", mode: "); if (local) printf("local"); else printf("remote"); if (network == 0) { printf(", modem: %s",gmdmtyp()); } else { if (nettype == NET_TCPA) printf(", TCP/IP"); if (nettype == NET_TCPB) printf(", TCP/IP"); if (nettype == NET_DEC) { if ( ttnproto == NP_LAT ) printf(", DECnet LAT"); else if ( ttnproto == NP_CTERM ) printf(", DECnet CTERM"); else printf(", DECnet"); } if ( nettype == NET_SLAT ) printf(", Meridian Technologies' SuperLAT") ;#ifdef NETFILE if ( nettype == NET_FILE ) printf(", local file") ;#endif /* NETFILE */ if (nettype == NET_PIPE) printf(", Named Pipes");#ifdef ANYX25 shox25();#endif /* ANYX25 */ if (ttnproto == NP_TELNET) printf(", telnet protocol"); } if (local) { i = parity ? 7 : 8; if (i == 8) i = (cmask == 0177) ? 7 : 8; printf("\n Terminal bits: %d, p",i); } else printf("\n P"); printf("arity: %s",parnam((char)parity)); printf(", duplex: "); if (duplex) printf("half, "); else printf("full, "); printf("flow: "); if (flow == FLO_KEEP) printf("keep"); else if (flow == FLO_AUTO) printf("auto"); else if (flow == FLO_XONX) printf("xon/xoff"); else if (flow == FLO_NONE) printf("none"); else if (flow == FLO_RTSC) printf(network ? "none" : "rts/cts"); else if (flow == FLO_DTRT) printf(network ? "none" : "dtr/cts"); else if (flow == FLO_DTRC) printf(network ? "none" : "dtr/cd"); else printf("%d",flow); printf(", handshake: "); if (turn) printf("%d\n",turnch); else printf("none\n"); if (local && !network) { /* Lockfile & carrier stuff */ if (carrier == CAR_OFF) s = "off"; else if (carrier == CAR_ON) s = "on"; else if (carrier == CAR_AUT) s = "auto"; else s = "unknown"; printf(" Carrier: %s", s); if (carrier == CAR_ON) { if (cdtimo) printf(", timeout: %d sec", cdtimo); else printf(", timeout: none"); }#ifdef UNIX if (haslock && *flfnam) { /* Lockfiles only apply to UNIX... */ printf(", lockfile: %s",flfnam); }#endif /* UNIX */ printf("\n Escape character: %d (^%c)\n",escape,ctl(escape)); }}#ifdef TNCODEstatic VOIDshotel() { printf("SET TELNET parameters:\n echo: %s\n NVT newline-mode: ", tn_duplex ? "local" : "remote"); switch (tn_nlm) { case TNL_CRNUL: printf("%s\n","off (cr-nul)"); break; case TNL_CRLF: printf("%s\n","on (cr-lf)"); break; case TNL_CR: printf("%s\n","raw (cr)"); break; case TNL_LF: printf("%s\n","(lf)"); break; } printf(" BINARY newline-mode: "); switch (tn_b_nlm) { case TNL_CRNUL: printf("%s\n","off (cr-nul)"); break; case TNL_CRLF: printf("%s\n","on (cr-lf)"); break; case TNL_CR: printf("%s\n","raw (cr)"); break; case TNL_LF: printf("%s\n","(lf)"); break; } printf(" binary-mode: "); switch ( tn_binary ) { case TN_BM_AC: printf( "accepted, " ); break ; case TN_BM_RF: printf( "refused, " ); break; case TN_BM_RQ: printf( "requested, "); break; }; printf("host=%s, c-kermit=%s\n", u_binary ? "BINARY" : "NVT", me_binary ? "BINARY" : "NVT" ) ; printf(" bug binary-me-means-u-too: %s\n",showoff(tn_b_meu)); printf(" bug binary-u-means-me-too: %s\n",showoff(tn_b_ume)); printf(" terminal-type: "); if (tn_term) { printf("%s\n",tn_term); } else { char *p;#ifdef OS2 p = (tt_type >= 0 && tt_type <= max_tt) ? tt_info[tt_type].x_name : "UNKNOWN";#else p = getenv("TERM");#endif /* OS2 */ if (p) printf("none (%s will be used)\n",p); else printf("none\n"); }}#endif /* TNCODE */#ifdef CK_NETBIOS static VOIDshonb() { printf("NETBIOS parameters:\n"); printf(" API : %s\n", NetbeuiAPI ? "NETAPI.DLL - IBM Extended Services or Novell Netware Requester" : "ACSNETB.DLL - IBM Network Transport Services/2" ) ; printf(" Local Name: [%s]\n", NetBiosName ) ; printf(" Adapter : %d\n", NetBiosAdapter ) ; if ( NetBiosLSN > 0xFF ) printf(" Session : %d\n", NetBiosLSN ) ; else printf(" Session : none active\n") ;}#endif /* CK_NETBIOS */VOIDshonet() {#ifndef NETCONN printf("\nNo networks are supported in this version of C-Kermit\n");#else /* rest of this routine */ int i;#ifndef NODIAL if (nnetdir <= 1) { printf("\nNetwork directory: %s\n",netdir[0] ? netdir[0] : "(none)"); } else { int i; printf("\nNetwork directories:\n"); for (i = 0; i < nnetdir; i++) printf("%2d. %s\n",i,netdir[i]); }#endif /* NODIAL */#ifdef OS2 printf("\nNetwork availability:\n");#else printf("\nSupported networks:\n");#endif /* OS2 */#ifdef VMS#ifdef MULTINET printf(" TGV MultiNet TCP/IP");#else#ifdef WINTCP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -