📄 ckuusy.c
字号:
break;case 'y': /* Alternate init-file name */ if (*(xp+1)) { XFATAL("invalid argument bundling after -y"); } xargv++, xargc--; if (xargc < 1) { XFATAL("missing filename in -y"); } /* strcpy(kermrc,*xargv); ...this was already done in prescan()... */ break;#endif /* NOICP */#ifndef NOLOCALcase 'l': /* SET LINE */#ifdef NETCONN#ifdef ANYX25case 'X': /* SET HOST to X.25 address */#ifdef SUNX25case 'Z': /* SET HOST to X.25 file descriptor */#endif /* SUNX25 */#endif /* ANYX25 */#ifdef TCPSOCKETcase 'J':case 'j': /* SET HOST (TCP/IP socket) */#endif /* TCPSOCKET */#endif /* NETCONN */ network = 0; if (*(xp+1)) { XFATAL("invalid argument bundling after -l or -j"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("communication line device name missing"); }#ifdef NETCONN if (x == 'J') { cflg = 1; /* Connect */ stayflg = 1; /* Stay */ tn_exit = 1; /* Telnet-like exit condition */ }#endif /* NETCONN */ strcpy(ttname,*xargv); local = (strcmp(ttname,CTTNAM) != 0);/* NOTE: We really do not need to call ttopen here, since it should be called again later, automatically, when we first try to condition the device via ttpkt or ttvt. Calling ttopen here has the bad side effect of making the order of the -b and -l options significant, but order of command-line options should not matter. However, the network cases immediately below complicate matters a bit, so we'll settle this in a future edit.*/ if (x == 'l') { if (ttopen(ttname,&local,mdmtyp,0) < 0) { XFATAL("can't open device"); } debug(F101,"cmdlin speed","",speed); speed = ttgspd(); /* get it. */#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 */ strncpy(line, ttname, YYBUFLEN); /* Working copy of the name */ for (s = line; *s != '\0' && *s != ':'; s++); /* and service */ if (*s) { *s++ = '\0'; strncpy(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++; strncpy(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); } else { strcat(line, ":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) { strcpy(line,nh_p[i]); /* Copy the current entry to line */ /* 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 */ strcpy(ttname, line);#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 */ } if (ttopen(ttname,&local,mdmtyp,0) < 0) { XFATAL("can't open host connection"); } network = 1;#endif /* NETCONN */ } /* add more here later - decnet, etc... */ 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"); } strcpy(udata,*xargv); 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 */case '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;case 'i': /* Treat files as binary */ binary = XYFT_B; break; case 'w': /* Writeover */ warn = 0; fncact = XYFX_X; break; case 'q': /* Quiet */ quiet = 1; break; #ifdef DEBUGcase 'd': /* DEBUG */ break; /* Handled in prescan() */#endif /* DEBUG */ case '8': /* 8-bit clean */ parity = 0; cmdmsk = 0xff; cmask = 0xff; 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 */ bgset = 0; backgrd = 0; break;#ifndef NOSPLcase 'M': /* My User Name */ /* Already done in prescan() */ if (*(xp+1)) { XFATAL("invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing username"); }#ifdef COMMENT if ((int)strlen(*xargv) > 63) { XFATAL("username too long"); } strcpy(uidbuf,*xargv);#endif /* COMMENT */ break;#endif /* NOSPL */#ifdef CK_NETBIOScase 'N': /* NetBios Adapter Number follows */ if (*(xp+1)) { XFATAL("invalid argument bundling after -N"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("missing NetBios Adapter number"); } if ((strlen(*xargv) != 1) || (*xargv)[0] != 'X' || ((atoi(*xargv) < 0) || (atoi(*xargv) > 9)) ) { XFATAL("Invalid NetBios Adapter - Adapters 0 to 9 are valid"); } break;#endif /* CK_NETBIOS */#ifdef NETCONNcase 'F': network = 1; if (*(xp+1)) { XFATAL("invalid argument bundling after -F"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("network file descriptor missing"); } strcpy(ttname,*xargv); nettype = NET_TCPB; mdmtyp = -nettype; telnetfd = 1; local = 1; break;#endif /* NETCONN */#ifdef OS2PMcase 'P': /* OS/2 Presentation Manager */ if (*(xp+1)) { XFATAL("invalid argument bundling after -P"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("pipe data missing"); } pipedata = *xargv; break;#endif /* OS2PM */#ifndef NOICPcase 'H': noherald = 1; break;#endif /* NOICP */#ifdef OS2case 'W': if (*(xp+1)) { XFATAL("invalid argument bundling after -W"); } xargv++, xargc--; if ((xargc < 1)) { /* could be negative */ XFATAL("Window handle missing"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("Kermit Instance missing"); } /* Action done in prescan */ break;#endif /* OS2 */default: fatal2(*xargv,#ifdef NT "invalid command-line option, type \"k95 -h\" for help"#else#ifdef OS2 "invalid command-line option, type \"ckermit -h\" for help"#else "invalid command-line option, type \"kermit -h\" for help"#endif /* OS2 */#endif /* NT */ ); } x = *++xp; /* See if options are bundled */ } return(0);}#else /* No command-line interface... */extern int xargc;intcmdlin() { if (xargc > 1) { XFATAL("Sorry, command-line options disabled."); }}#endif /* NOCMDL */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -