📄 ckuusy.c
字号:
" -k realm Set default Kerberos realm\n",""};staticchar *hlp3[] = { /* rlogin */" [option-list] host[:port] [port]\n"," The option-list consists of zero, one, or more of:\n"," -d Turn on debug mode\n"," -l user Set username\n",""};staticchar *hlp4[] = { /* ssh */" [option-list] host[:port] [port]\n"," The option-list consists of zero, one, or more of:\n"," -d Turn on debug mode\n"," -l user Set username\n",""};/* Command-line option help lines. Update this when adding new options! */char * opthlp[128]; /* Option help */char * arghlp[128]; /* Argument for option */int optact[128]; /* Action-option flag */VOIDfatal2(msg1,msg2) char *msg1, *msg2; { char buf[256]; if (!msg1) msg1 = ""; if (!msg2) msg2 = ""; ckmakmsg(buf,256,"\"",msg1,"\" - ",msg2);#ifndef NOICP if (what == W_COMMAND) printf("%s\n",buf); else#endif /* NOICP */ fatal((char *)buf);}static SIGTYP#ifdef CK_ANSIcl_int(int dummy)#else /* CK_ANSI */cl_int(dummy) int dummy;#endif /* CK_ANSI */{ /* Command-line interrupt handler */ doexit(BAD_EXIT,1); SIGRETURN;}#ifdef NEWFTPextern int ftp_action, ftp_cmdlin;static intxx_ftp(host, port) char * host, * port; {#ifdef CK_URL extern int haveurl;#endif /* CK_URL */ extern char * ftp_logname; int use_tls = 0; char * p; if (port) if (!*port) port = NULL; if (!host) return(0); if (!*host) return(0); debug(F111,"ftp xx_ftp host",ftp_host,haveftpuid); debug(F111,"ftp xx_ftp uidbuf 1",uidbuf,haveftpuid); ftp_cmdlin = 1; /* 1 = FTP started from command line */ if (nfils > 0) ftp_cmdlin++; /* 2 = same plus file transfer */#ifndef NOURL debug(F111,"ftp xx_ftp g_url.usr",g_url.usr,g_url.usr); if (haveurl && g_url.usr) { /* Wed Oct 9 15:15:22 2002 */ if (!*(g_url.usr)) { /* Force username prompt if */ haveftpuid = 0; /* "ftp://:@host" given. */ uidbuf[0] = NUL; makestr(&ftp_logname,NULL); } debug(F111,"ftp xx_ftp uidbuf 2",uidbuf,haveftpuid); }#endif /* NOURL */ debug(F111,"ftp xx_ftp uidbuf 3",uidbuf,haveftpuid); if (haveftpuid) { makestr(&ftp_logname,uidbuf); debug(F111,"ftp_logname",ftp_logname,haveftpuid); } if (!port) { if ((p = ckstrchr(ftp_host,':'))) *p++ = NUL; port = p; } if (!port) {#ifdef CK_URL if (haveurl) { if (g_url.por) port = g_url.por; else if (g_url.svc) port = g_url.svc; else port = "ftp"; } else#endif /* CK_URL */ port = "ftp"; }#ifdef CK_SSL if (haveurl && g_url.svc) use_tls = !ckstrcmp("ftps",g_url.svc,-1,0);#endif /* CK_SSL */ if (ftpopen(ftp_host,port,use_tls) < 1) return(-1); debug(F111,"ftp xx_ftp action",ckctoa((char)ftp_action),nfils); if (nfils > 0) { switch (ftp_action) { case 'g': return(cmdlinget(stayflg)); case 'p': case 's': return(cmdlinput(stayflg)); } } return(1);}#endif /* NEWFTP */#ifndef NOHTTPstaticchar * http_hlp[] = { " -h This message.\n", " -d Debug to debug.log.\n", " -S Stay (issue command prompt when done).\n", " -Y Do not execute Kermit initialization file.\n", " -q Quiet (suppress most messages).\n", " -u name Username.\n", " -P password Password.\n", " -g pathname Get remote pathname.\n", " -p pathname Put remote pathname.\n", " -H pathname Head remote pathname.\n", " -l pathname Local path for -g, -p, and -H.\n",#ifdef CK_SSL " -z opt[=value] Security options...\n", " cert=file Client certificate file\n", " certsok Accept all certificates\n", " key=file Client private key file\n", " secure Use SSL\n", " verify=n 0 = none, 1 = peer , 2 = certificate required\n",#endif /* CK_SSL */ ""};#define HT_CERTFI 0#define HT_OKCERT 1#define HT_KEY 2#define HT_SECURE 3#define HT_VERIFY 4static struct keytab httpztab[] = { { "cert", HT_CERTFI, CM_ARG }, { "certsok", HT_OKCERT, 0 }, { "key", HT_KEY, CM_ARG }, { "secure", HT_SECURE, 0 }, { "verify", HT_VERIFY, CM_ARG }, { "", 0, 0 }};static int nhttpztab = sizeof(httpztab) / sizeof(struct keytab) - 1;#endif /* NOHTTP *//* U S A G E */VOIDusage() {#ifdef MINIX conol("Usage: "); conol(xarg0); conol(" [-x arg [-x arg]...[-yyy]..] ]\n");#else conol("Usage: "); conol(xarg0); if (howcalled == I_AM_KERMIT || howcalled == I_AM_IKSD || howcalled == I_AM_SSHSUB) conola(hlp1); else if (howcalled == I_AM_TELNET) conola(hlp2); else if (howcalled == I_AM_RLOGIN) conola(hlp3); else if (howcalled == I_AM_SSH) conola(hlp4); if (howcalled == I_AM_KERMIT || howcalled == I_AM_IKSD || howcalled == I_AM_SSHSUB) { int c; conoll(""); conoll("Complete listing of command-line options:"); conoll(""); for (c = 31; c < 128; c++) { if (!opthlp[c]) continue; if (arghlp[c]) { printf(" -%c <arg>%s\n", (char)c, (optact[c] ? " (action option)" : "") ); printf(" %s\n",opthlp[c]); printf(" Argument: %s\n\n",arghlp[c]); } else { /* Option without arg */ printf(" -%c %s%s\n", (char)c, opthlp[c], (optact[c]?" (action option)":"") ); printf(" Argument: (none)\n\n"); } }#ifdef OS2ORUNIX printf("To prevent this message from scrolling, use '%s -h | more'.\n", xarg0);#endif /* OS2ORUNIX */ printf("For a list of extended options use '%s --help'.\n", xarg0); }#endif /* MINIX */}/* C M D L I N -- Get arguments from command line */intcmdlin() { char x; /* Local general-purpose char */ extern int haveurl;#ifdef NEWFTP char * port = NULL;#endif /* NEWFTP */#ifndef NOXFER cmarg = ""; /* Initialize globals */ cmarg2 = "";#endif /* NOXFER */ action = 0; cflg = 0; signal(SIGINT,cl_int);/* Here we handle different "Command Line Personalities" */#ifdef TCPSOCKET#ifndef NOHTTP if (howcalled == I_AM_HTTP) { /* If I was called as HTTP... */ char rdns[128];#ifdef OS2 char * agent = "Kermit 95";#else char * agent = "C-Kermit";#endif /* OS2 */ debug(F100,"http personality","",0);#ifdef CK_URL if (haveurl) { int type; char * lfile; type = lookup(urltab,g_url.svc,nurltab,NULL); if (!(type == URL_HTTP || type == URL_HTTPS)) { printf("?Internal Error: HTTP command line processing\n"); debug(F100,"Error: HTTP command line processing","",0); doexit(BAD_EXIT,1); } rdns[0] = '\0'; lfile = ""; x = (http_open(g_url.hos,g_url.por ? g_url.por : g_url.svc, type == URL_HTTPS, rdns,128,NULL) == 0); if (x) {#ifdef KUI char asname[CKMAXPATH+1];#endif /* KUI */ if (!quiet) { if (rdns[0]) printf("Connected to %s [%s]\r\n",g_url.hos,rdns); else printf("Connected to %s\r\n",g_url.hos); } if (g_url.pth) zstrip(g_url.pth,&lfile); else g_url.pth = "/"; if (!*lfile) lfile = "index.html";#ifdef KUI if (uq_file(NULL, /* K95 GUI: Put up file box. */ NULL, /* (not tested...) */ 4, NULL, lfile, asname, CKMAXPATH+1 ) > 0) lfile = asname;#endif /* KUI */ x = http_get(agent, NULL, /* hdrlist */ g_url.usr, g_url.psw, 0, lfile, g_url.pth, 0 /* stdio */ ); x = (http_close() == 0); } else { if (!quiet) printf("?HTTP Connection failed.\r\n"); } doexit(x ? GOOD_EXIT : BAD_EXIT, -1); } else #endif /* CK_URL */ { int http_action = 0; char * host = NULL, * svc = NULL, * lpath = NULL; char * user = NULL, * pswd = NULL, * path = NULL; char * xp; while (--xargc > 0) { /* Go through command line words */ xargv++; debug(F111,"cmdlin http xargv",*xargv,xargc); xp = *xargv+1; if (**xargv == '-') { /* Got an option */ int xx; x = *(*xargv+1); /* Get the option letter */ switch (x) { case 'd': /* Debug */#ifdef DEBUG if (deblog) { debtim = 1; } else { deblog = debopn("debug.log",0); }#endif /* DEBUG */ break; case 'S': /* Stay */ case 'Y': /* No initialization file */ break; /* (already done in prescan) */ case 'q': /* Quiet */ quiet = 1; break; case 'u': /* Options that require arguments */ case 'P': case 'g': case 'p': case 'H': case 'l': if (*(xp+1)) { XFATAL("Invalid argument bundling"); } xargv++, xargc--; if ((xargc < 1) || (**xargv == '-')) { XFATAL("Missing argument"); } switch (x) { case 'u': user = *xargv; break; case 'P': pswd = *xargv; break; case 'l': if (http_action != HTTP_PUT) lpath = *xargv; break; case 'g': http_action = HTTP_GET; path = *xargv; debug(F111,"cmdlin http GET",path,http_action); break; case 'p': http_action = HTTP_PUT; path = *xargv; break; case 'H': http_action = HTTP_HED; path = *xargv; } break;#ifdef CK_SSL case 'z': { /* *xargv contains a value of the form tag=value */ /* we need to lookup the tag and save the value */ int x,y,z; char * p, * q; makestr(&p,*xargv); y = ckindex("=",p,0,0,1); if (y > 0) p[y-1] = '\0'; x = lookup(httpztab,p,nhttpztab,&z); if (x < 0) { printf("?Invalid security option: \"%s\"\n",p); } else { printf("Security option: \"%s",p); if (httpztab[z].flgs & CM_ARG) { q = &p[y]; if (!*q) fatal("?Missing required value"); } /* -z options w/args */ switch (httpztab[z].kwval) { case HT_CERTFI: makestr(&ssl_rsa_cert_file,q); break; case HT_OKCERT: ssl_certsok_flag = 1; break; case HT_KEY: makestr(&ssl_rsa_key_file,q); break; case HT_SECURE: svc="https"; break; case HT_VERIFY: if (!rdigits(q)) printf("?Bad number: %s\n",q); ssl_verify_flag = atoi(q);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -