⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckuusy.c

📁 KERMIT工具 这在办公室下载不了,很多人都没有载不到.
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "ckcsym.h"#define XFATAL fatal/*  C K U U S Y --  "User Interface" for Unix Kermit, part Y  *//*  Command-Line Argument Parser *//*  Authors:    Frank da Cruz <fdc@columbia.edu>,      The Kermit Project, Columbia University, New York City    Jeffrey E Altman <jaltman@secure-endpoints.com>      Secure Endpoints Inc., New York City  Copyright (C) 1985, 2004,    Trustees of Columbia University in the City of New York.    All rights reserved.  See the C-Kermit COPYING.TXT file or the    copyright text in the ckcmai.c module for disclaimer and permissions.*/#include "ckcdeb.h"char * bannerfile = NULL;char * helpfile = NULL;extern int xferlog, filepeek, nolinks;extern char * xferfile;extern int debtim;#include "ckcasc.h"#include "ckcker.h"#include "ckucmd.h"#include "ckcnet.h"#include "ckuusr.h"#include "ckcxla.h"#ifdef CK_SSL#include "ck_ssl.h"#endif /* CK_SSL */#include <signal.h>#ifdef OS2#include <io.h>#ifdef KUI#include "ikui.h"extern struct _kui_init kui_init;#endif /* KUI */#endif /* OS2 */extern int inserver, fncnv, f_save, xfermode;#ifdef PATTERNSextern int patterns;#endif /* PATTERNS */#ifndef NOICPextern int cmdint;#endif /* NOICP */extern int xsuspend;#ifdef NETCONN#ifdef ANYX25extern int revcall, closgr, cudata;extern char udata[];extern int x25fd;#endif /* ANYX25 */#ifndef VMS#ifndef OS2#ifndef OSKextern#endif /* OSK */#endif /* OS2 */#endif /* VMS */int telnetfd;extern struct keytab netcmd[];extern int tn_exit;#ifndef NOICP#ifndef NODIALextern int nnets, nnetdir;              /* Network services directory */extern char *netdir[];extern char *nh_p[];                    /* Network directory entry pointers */extern char *nh_p2[];                   /* Network directory entry nettype */extern char *nh_px[4][MAXDNUMS + 1];#endif /* NODIAL */extern int nhcount;extern char * n_name;                   /* Network name pointer */#endif /* NOICP */#endif /* NETCONN */#ifndef NOSPLextern int nmac;extern struct mtab *mactab;#endif /* NOSPL */extern char uidbuf[];#ifdef CK_LOGINextern int logintimo;#endif /* CK_LOGIN */extern char * myname, * dftty;extern int howcalled;extern char *ckxsys, *ckzsys, **xargv, *xarg0, **cmlist, *clcmds;extern int action, cflg, xargc, cnflg, local, quiet, escape, network, mdmtyp,  bgset, backgrd, xargs, binary, parity, turn, turnch, duplex, flow, clfils,  noinit, stayflg, nettype, cfilef, noherald, cmask, cmdmsk, exitonclose,  haveline, justone, cxtype, xfinish, ttnproto;extern long speed;extern char ttname[];extern char * pipedata, * cmdfil;#ifndef NOXFERextern char *cmarg, *cmarg2;extern int nfils, stdouf, stdinf, displa, maxrps, rpsiz, ckwarn, urpsiz,  wslotr, swcapr, ckdelay, recursive, reliable, xreliable, fnspath, fncact,  clearrq, setreliable;#ifdef PIPESENDextern int usepipes, pipesend;#endif /* PIPESEND */extern int protocol;#endif /* NOXFER */#ifndef NOPUSHextern int nopush;#endif /* NOPUSH */#ifdef OS2extern struct keytab os2devtab[];extern int nos2dev;extern int ttslip;extern int tt_scroll, tt_escape;#ifdef OS2PMextern int os2pm;#endif /* OS2PM */#endif /* OS2 */#ifdef CK_NETBIOSextern unsigned char NetBiosAdapter;#endif /* CK_NETBIOS */#ifdef XFATAL#undef XFATAL#endif /* XFATAL */#ifdef TNCODE_PROTOTYP(static int dotnarg, (char x) );#endif /* TNCODE */#ifdef RLOGCODE_PROTOTYP(static int dorlgarg, (char x) );#endif /* RLOGCODE */#ifdef SSHBUILTIN_PROTOTYP(static int dossharg, (char x) );#endif /* SSHBUILTIN */int haveftpuid = 0;			/* Have FTP user ID */static int have_cx = 0;			/* Have connection */#ifdef NEWFTPextern char * ftp_host;#endif /* NEWFTP */extern int what;#ifndef NOICP#ifndef NODIALextern int nmdm, telephony;extern struct keytab mdmtab[];extern int usermdm, dialudt;#endif /* NODIAL */_PROTOTYP(static int pmsg, (char *) );_PROTOTYP(static int fmsg, (char *) );static int pmsg(s) char *s; { printf("%s\n", s); return(0); }static int fmsg(s) char *s; { fatal(s); return(0); }#define XFATAL(s) return(what==W_COMMAND?pmsg(s):fmsg(s))#else#define XFATAL fatal#endif /* NOICP */#ifndef NOHTTP#define HTTP_GET 1#define HTTP_PUT 2#define HTTP_HED 3#endif /* NOHTTP */#ifdef CK_URL/* URLs we recognize */#define URL_FTP    1#define URL_HTTP   2#define URL_HTTPS  3#define URL_IKSD   4#define URL_TELNET 5#define URL_LOGIN  6struct keytab urltab[] = {#ifdef NEWFTP    "ftp",    URL_FTP,    0,#endif /* NEWFTP */#ifndef NOHTTP    "http",   URL_HTTP,   0,    "https",  URL_HTTPS,  0,#endif /* NOHTTP */    "iksd",   URL_IKSD,   0,    "kermit", URL_IKSD,   0,    "telnet", URL_TELNET, 0,    "", 0, 0};int nurltab = sizeof(urltab)/sizeof(struct keytab) - 1;#ifndef URLBUFLEN#define URLBUFLEN 1024#endif /* URLBUFLEN */static char urlbuf[URLBUFLEN];struct urldata g_url = {NULL,NULL,NULL,NULL,NULL,NULL,NULL};/* u r l p a r s e  --  Parse a possible URL *//*  Returns 0 if the candidate does not seem to be a URL.  Returns 1 if it might be a URL, with the above pointers set to its pieces:    service : [ // ] [ user [ : password ] @ ] host [ : service ] [ / path ]  Example: ftp://ds.internic.net:21/rfc/rfc1234.txt    url.svc = [ftp]    url.usr = [(NULL)]    url.psw = [(NULL)]    url.hos = [ds.internic.net]    url.por = [21]    url.pth = [rfc/rfc1234.txt]  It might be a URL if it contains a possible service name followed by a  a colon (:).  Thus "telnet:xyzcorp.com" is a minimal URL, whereas a  full-blown example would be:    ftp://olga:secret@ftp.xyzcorp.com/public/oofa.txt  The caller must verify the results, i.e. that the service string is a real  TCP service, etc.  This routine just parses the fields.  struct urldata defined in ckcker.h*/inturlparse(s,url) char *s; struct urldata * url; {    char * p = NULL, * urlbuf = NULL;    int x;    if (!s || !url)        return(0);    if (!*s)        return(0);    makestr(&urlbuf,s);    if (url->sav) {			/* In case we were called before... */        free(url->sav);        url->sav = NULL;    }    if (url->svc) {        free(url->svc);        url->svc = NULL;    }    if (url->hos) {        free(url->hos);        url->hos = NULL;    }    if (url->por) {        free(url->por);        url->por = NULL;    }    if (url->usr) {        free(url->usr);        url->usr = NULL;    }    if (url->psw) {        free(url->psw);        url->psw = NULL;    }    if (url->pth) {        free(url->pth);        url->pth = NULL;    }    p = urlbuf;				/* Was a service requested? */    while (*p && *p != ':')		/* Look for colon */      p++;    if (*p == ':') {                    /* Have a colon */        *p++ = NUL;			/* Get service name or number */        if (*p == ':')			/* a second colon */          *p++ = NUL;			/* get rid of that one too */        while (*p == '/') *p++ = NUL;	/* and slashes */#ifdef COMMENT        /* Trailing slash is part of path - leave it - jaltman */        x = strlen(p);                  /* Length of remainder */        if (p[x-1] == '/')              /* If there is a trailing slash */          p[x-1] = NUL;			/* remove it. */#endif /* COMMENT */        if (urlbuf[0]) {		/* Anything left? */            char *q = p, *r = p, *w = p;	    makestr(&url->svc,urlbuf);            while (*p != NUL && *p != '@') /* look for @ */	      p++;            if (*p == '@') {		/* Signifies user ID, maybe password */                *p++ = NUL;		url->hos = p;                while (*w != NUL && *w != ':')                  w++;                if (*w == ':')                  *w++ = NUL;		url->usr = r;		/* Username */		if (*w)		  url->psw = w;		/* Password */                q = p;            } else {			/* No username or password */                p = q;		url->hos = p;            }	    debug(F111,"urlparse url->usr",url->usr,url->usr);	    debug(F111,"urlparse url->psw",url->usr,url->psw);	    debug(F111,"urlparse url->hos",url->usr,url->hos);            while (*p != NUL && *p != ':' && *p != '/')	/* Port? */              p++;            if (*p == ':') {		/* TCP port */                *p++ = NUL;                r = p;		url->por = r;                while (*p != NUL && *p != '/')		  p++;                /* '/' is part of path, leave it until we can copy */                if (*p == '/') {		    makestr(&url->pth,p);  /* Path */		    *p = NUL;                }            } else {			/* No port */                /* '/' is part of path, leave it */                if (*p == '/') {		    makestr(&url->pth,p);  /* Path */		    *p = NUL;                }            }        }	/* Copy non-NULL result strings */	if (url->svc) if (*url->svc) {            p = url->svc;            url->svc = NULL;            makestr(&url->svc,p);        }	if (url->hos) if (*url->hos) {            p = url->hos;            url->hos = NULL;            makestr(&url->hos,p);        }	if (url->por) if (*url->por) {            p = url->por;            url->por = NULL;            makestr(&url->por,p);        }/*  WARNING (Wed Oct  9 16:09:03 2002): We now allow the username and  password to be empty strings.  These are treated differently from null  pointers: an empty string means the URL included username and/or password  fields that were empty, e.g. ftp://:@ftp.xyzcorp.com/somepath/somefile,  which causes the client to prompt for the username and/or password.*/	if (url->usr) /* if (*url->usr) */ {            p = url->usr;            url->usr = NULL;            makestr(&url->usr,p);        }	if (url->psw) /* if (*url->psw) */ {            p = url->psw;            url->psw = NULL;            makestr(&url->psw,p);        }        /* Save a copy of the full url if one was found. */	if (url->svc) 	  makestr(&url->sav,s);        free(urlbuf);	return(url->svc ? 1 : 0);    }    return(0);}#endif /* CK_URL */#ifndef NOCMDLchar *hlp1[] = {#ifndef NOICP" [filename] [-x arg [-x arg]...[-yyy]..] [ = text ] ]\n",#else"[-x arg [-x arg]...[-yyy]..]\n",#endif /* NOICP */"\n","  -x is an option requiring an argument, -y an option with no argument.\n","  If the first command-line argument is the name of a file, interactive-\n","  mode commands are executed from the file.  The '=' argument tells Kermit\n","  not to parse the remainder of the command line, but to make the words\n","  following '=' available as \\%1, \\%2, ... \\%9.  The command file \(if any)\n","  is executed before the command-line options.\n","\n",#ifndef NOICP"If no action command is included, or -S is, then after the command line is\n","executed, Kermit issues its prompt and waits for you to type commands.\n",#else"Operation by command-line options only.\n",#endif /* NOICP */""};staticchar *hlp2[] = {"  [option-list] host[:port] [port]\n","  The option-list consists of zero, one, or more of:\n","  -8                Negotiate Telnet Binary in both directions\n","  -a                Require use of Telnet authentication\n","  -d                Turn on debug mode\n","  -E                No escape character\n","  -K                Refuse use of authentication; do not send username\n","  -l user           Set username and request Telnet authentication\n","  -L                Negotiate Telnet Binary Output only\n","  -x                Require Encryption\n","  -D                Disable forward-X\n","  -T cert=file      Use certificate in file\n","  -T key=file       Use private key in file\n","  -T crlfile=file   Use CRL in file\n","  -T crldir=dir     Use CRLs in directory\n","  -T cipher=string  Use only ciphers in string\n","  -f                Forward credentials to host\n",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -