📄 ckuusy.c
字号:
*/ if (x == 'l') { if (ttopen(ttname,&local,mdmtyp,0) < 0) { XFATAL("can't open device"); }#ifdef CKLOGDIAL dologline();#endif /* CKLOGDIAL */ debug(F101,"doarg speed","",speed); cxtype = (mdmtyp > 0) ? CXT_MODEM : CXT_DIRECT; speed = ttgspd(); /* Get the speed. */ setflow(); /* Do something about flow control. */#ifndef NOSPL if (local) { if (nmac) { /* Any macros defined? */ int k; /* Yes */ k = mlook(mactab,"on_open",nmac); /* Look this up */ if (k >= 0) { /* If found, */ if (dodo(k,ttname,0) > -1) /* set it up, */ parser(1); /* and execute it */ } } }#endif /* NOSPL */#ifdef NETCONN } else { if (x == 'j' || x == 'J') { /* IP network host name */ char * s = line; char * service = tmpbuf; if (xargc > 0) { /* Check if it's followed by */ /* A service name or number */ if (*(xargv+1) && *(*(xargv+1)) != '-') { xargv++, xargc--; strcat(ttname,":"); strcat(ttname,*xargv); } } nettype = NET_TCPB; mdmtyp = -nettype; /* Perhaps already set in init file */ telnetfd = 1; /* Or maybe an open file descriptor */ ckstrncpy(line, ttname, YYBUFLEN); /* Working copy of the name */ for (s = line; *s != '\0' && *s != ':'; s++); /* and service */ if (*s) { *s++ = '\0'; ckstrncpy(service, s, YYBUFLEN); } else *service = '\0'; s = line;#ifndef NODIAL#ifndef NOICP /* Look up in network directory */ x = 0; if (*s == '=') { /* If number starts with = sign */ s++; /* strip it */ while (*s == SP) /* and also any leading spaces */ s++; ckstrncpy(line,s,YYBUFLEN); /* Do this again. */ nhcount = 0; } else if (!isdigit(line[0])) {/* nnetdir will be greater than 0 if the init file has been processed and it contained a SET NETWORK DIRECTORY command.*/ xx = 0; /* Initialize this */ if (nnetdir > 0) /* If there is a directory... */ xx = lunet(line); /* Look up the name */ else /* If no directory */ nhcount = 0; /* we didn't find anything there */ if (xx < 0) { /* Lookup error: */ sprintf(tmpbuf, "?Fatal network directory lookup error - %s\n", line ); XFATAL(tmpbuf); } }#endif /* NOICP */#endif /* NODIAL */ /* Add service to line specification for ttopen() */ if (*service) { /* There is a service specified */ strcat(line, ":"); strcat(line, service); ttnproto = NP_DEFAULT; } else { strcat(line, ":telnet"); ttnproto = NP_TELNET; }#ifndef NOICP#ifndef NODIAL if ((nhcount > 1) && !quiet && !backgrd) { printf("%d entr%s found for \"%s\"%s\n", nhcount, (nhcount == 1) ? "y" : "ies", s, (nhcount > 0) ? ":" : "." ); for (i = 0; i < nhcount; i++) printf("%3d. %s %-12s => %s\n", i+1, n_name, nh_p2[i], nh_p[i] ); } if (nhcount == 0) n = 1; else n = nhcount;#else n = 1; nhcount = 0;#endif /* NODIAL */ for (i = 0; i < n; i++) {#ifndef NODIAL if (nhcount >= 1) { /* Copy the current entry to line */ ckstrncpy(line,nh_p[i],LINBUFSIZ); /* Check to see if the network entry contains a service */ for (s = line ; (*s != '\0') && (*s != ':'); s++) ; /* If directory does not have a service ... */ if (!*s && *service) { /* and the user specified one */ strcat(line, ":"); strcat(line, service); } if (lookup(netcmd,nh_p2[i],nnets,&z) > -1) { mdmtyp = 0 - netcmd[z].kwval; } else { printf("Error - network type \"%s\" not supported\n", nh_p2[i] ); continue; } }#endif /* NODIAL */ }#endif /* NOICP */ ckstrncpy(ttname, line,TTNAMLEN+1); cxtype = CXT_TCPIP; /* Set connection type */ setflow(); /* Set appropriate flow control. */#ifdef SUNX25 } else if (x == 'X') { /* X.25 address */ nettype = NET_SX25; mdmtyp = -nettype; } else if (x == 'Z') { /* Open X.25 file descriptor */ nettype = NET_SX25; mdmtyp = -nettype; x25fd = 1;#endif /* SUNX25 */#ifdef STRATUSX25 } else if (x == 'X') { /* X.25 address */ nettype = NET_VX25; mdmtyp = -nettype;#endif /* STRATUSX25 */#ifdef IBMX25 } else if (x == 'X') { /* X.25 address */ nettype = NET_IX25; mdmtyp = -nettype;#endif /* IBMX25 */#ifdef HPX25 } else if (x == 'X') { /* X.25 address */ nettype = NET_HX25; mdmtyp = -nettype;#endif /* HPX25 */ } if (ttopen(ttname,&local,mdmtyp,0) < 0) { XFATAL("can't open host connection"); } network = 1;#ifdef CKLOGDIAL dolognet();#endif /* CKLOGDIAL */ cxtype = CXT_X25; /* Set connection type */ setflow(); /* Set appropriate flow control. */#ifndef NOSPL if (local) { if (nmac) { /* Any macros defined? */ int k; /* Yes */ k = mlook(mactab,"on_open",nmac); /* Look this up */ if (k >= 0) { /* If found, */ if (dodo(k,ttname,0) > -1) /* set it up, */ parser(1); /* and execute it */ } } }#endif /* NOSPL */#endif /* NETCONN */ } /* add more here -- decnet, etc... */ haveline = 1; break;#ifdef ANYX25case 'U': /* X.25 call user data */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing call user data string"); } ckstrncpy(udata,*xargv,MAXCUDATA); if ((int)strlen(udata) <= MAXCUDATA) { cudata = 1; } else { XFATAL("Invalid call user data"); } break;case 'o': /* X.25 closed user group */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing closed user group index"); } z = atoi(*xargv); /* Convert to number */ if (z >= 0 && z <= 99) { closgr = z; } else { XFATAL("Invalid closed user group index"); } break;case 'u': /* X.25 reverse charge call */ revcall = 1; break;#endif /* ANYX25 */#endif /* NOLOCAL */case 'b': /* Bits-per-second for serial device */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing bps"); } zz = atol(*xargv); /* Convert to long int */ i = zz / 10L;#ifndef NOLOCAL if (ttsspd(i) > -1) /* Check and set it */#endif /* NOLOCAL */ speed = ttgspd(); /* and read it back. */#ifndef NOLOCAL else { XFATAL("unsupported transmission rate"); }#endif /* NOLOCAL */ break;#ifndef NODIAL#ifndef NOICPcase 'm': /* Modem type */ if (*(xp+1)) { XFATAL("invalid argument bundling after -m"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("modem type missing"); } y = lookup(mdmtab,*xargv,nmdm,&z); if (y < 0) { XFATAL("unknown modem type"); } usermdm = 0; usermdm = (y == dialudt) ? x : 0; initmdm(y); break;#endif /* NOICP */#endif /* NODIAL */#ifndef NOXFERcase 'e': /* Extended packet length */ if (*(xp+1)) { XFATAL("invalid argument bundling after -e"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing length"); } z = atoi(*xargv); /* Convert to number */ if (z > 10 && z <= maxrps) { rpsiz = urpsiz = z; if (z > 94) rpsiz = 94; /* Fallback if other Kermit can't */ } else { XFATAL("Unsupported packet length"); } break;case 'v': /* Vindow size */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing or bad window size"); } z = atoi(*xargv); /* Convert to number */ if (z < 32) { /* If in range */ wslotr = z; /* set it */ if (z > 1) swcapr = 1; /* Set capas bit if windowing */ } else { XFATAL("Unsupported packet length"); } break;#endif /* NOXFER */case 'i': /* Treat files as binary */ binary = XYFT_B; xfermode = XMODE_M; /* Transfer mode manual */#ifdef PATTERNS patterns = 0;#endif /* PATTERNS */ break;#ifndef NOXFERcase 'w': /* Writeover */ ckwarn = 0; fncact = XYFX_X; break;#endif /* NOXFER */case 'q': /* Quiet */ quiet = 1; break;#ifdef DEBUGcase 'd': /* DEBUG */ break; /* Handled in prescan() */#endif /* DEBUG */case '0': { /* In the middle */ extern int tt_escape, lscapr; tt_escape = 0; /* No escape character */ flow = 0; /* No Xon/Xoff (what about hwfc?) */#ifndef NOXFER lscapr = 0; /* No locking shifts */#endif /* NOXFER */#ifdef CK_APC { extern int apcstatus; /* No APCs */ apcstatus = APC_OFF; }#endif /* CK_APC */#ifdef CK_AUTODL { /* No autodownload */ extern int autodl; autodl = 0; }#endif /* CK_AUTODL */#ifndef NOCSETS { extern int tcsr, tcsl; /* No character-set translation */ tcsr = 0; tcsl = tcsr; /* Make these equal */ }#endif /* NOCSETS */#ifdef TNCODE TELOPT_DEF_C_U_MODE(TELOPT_KERMIT) = TN_NG_RF; TELOPT_DEF_C_ME_MODE(TELOPT_KERMIT) = TN_NG_RF; TELOPT_DEF_S_U_MODE(TELOPT_KERMIT) = TN_NG_RF; TELOPT_DEF_S_ME_MODE(TELOPT_KERMIT) = TN_NG_RF;#endif /* TNCODE */}/* Fall thru... */case '8': /* 8-bit clean */ parity = 0; cmdmsk = 0xff; cmask = 0xff; break;case 'V': { extern int xfermode;#ifdef PATTERNS extern int patterns; patterns = 0; /* No patterns */#endif /* PATTERNS */ xfermode = XMODE_M; /* Manual transfer mode */ break;}case 'p': /* SET PARITY */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing parity"); } switch(x = **xargv) { case 'e': case 'o': case 'm': case 's': parity = x; break; case 'n': parity = 0; break; default: { XFATAL("invalid parity"); } } break;case 't': /* Line turnaround handshake */ turn = 1; turnch = XON; /* XON is turnaround character */ duplex = 1; /* Half duplex */ flow = 0; /* No flow control */ break;case 'B': bgset = 1; /* Force background (batch) */ backgrd = 1; break;case 'z': /* Force foreground */ bg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -