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

📄 ckuus6.c

📁 C-Kermit源码。是使用串口/Modem和网络通讯的程序
💻 C
📖 第 1 页 / 共 5 页
字号:
#endif /* NETCONN */#ifdef CK_AUTHENTICATION_PROTOTYP(int ck_krb4_is_installed,(void));_PROTOTYP(int ck_krb5_is_installed,(void));_PROTOTYP(int ck_ntlm_is_installed,(void));_PROTOTYP(int ck_srp_is_installed,(void));_PROTOTYP(int ck_ssleay_is_installed,(void));_PROTOTYP(int ck_crypt_is_installed,(void));#else#define ck_krb4_is_installed() (0)#define ck_krb5_is_installed() (0)#define ck_ntlm_is_installed() (0)#define ck_srp_is_installed() (0)#define ck_ssleay_is_installed() (0)#define ck_crypt_is_installed() (0)#endif /* CK_AUTHENTICATION */#define AV_KRB4   1#define AV_KRB5   2#define AV_NTLM   3#define AV_SRP    4#define AV_SSL    5#define AV_CRYPTO 6struct keytab availtab[] = {		/* Available authentication types */    "crypto",     AV_CRYPTO, CM_INV,	/* and encryption */    "encryption", AV_CRYPTO, 0,    "k4",         AV_KRB4,   CM_INV,    "k5",         AV_KRB5,   CM_INV,    "kerberos4",  AV_KRB4,   0,    "kerberos5",  AV_KRB5,   0,    "krb4",       AV_KRB4,   CM_INV,    "krb5",       AV_KRB5,   CM_INV,    "ntlm",       AV_NTLM,   0,    "srp",        AV_SRP,    0,    "ssl",        AV_SSL,    0,    "tls",        AV_SSL,    0,    "",           0,         0};int availtabn = sizeof(availtab)/sizeof(struct keytab)-1;#ifndef NODIAL_PROTOTYP(static int ddcvt, (char *, FILE *, int) );_PROTOTYP(static int dncvt, (int, int, int, int) );_PROTOTYP(char * getdname, (void) );static int partial  = 0;		/* For partial dial */static char *dscopy = NULL;int dialtype = -1;char *dialnum = (char *)0;		/* Remember DIAL number for REDIAL */int dirline = 0;			/* Dial directory line number */extern char * dialdir[];		/* Dial directory file names */extern int dialdpy;			/* DIAL DISPLAY on/off */extern int ndialdir;			/* How many dial directories */extern int ntollfree;			/* Toll-free call info */extern int ndialpxx;			/* List of PBX exchanges */extern char *dialtfc[];char * matchpxx = NULL;			/* PBX exchange that matched */extern int nlocalac;			/* Local area-code list */extern char * diallcac[];extern int tttapi;#ifdef CK_TAPIextern int tapiconv;			/* TAPI Conversions */extern int tapipass;			/* TAPI Passthrough */#endif /* CK_TAPI */extern int dialatmo;extern char * dialnpr, * dialsfx;extern char * dialixp, * dialixs, * dialmac;extern char * dialldp, * diallds, * dialtfp;extern char * dialpxi, * dialpxo, * diallac;extern char * diallcp, * diallcs, * diallcc;extern char * dialpxx[];extern int dialcnf;			/* DIAL CONFIRMATION */int dialfld = 0;			/* DIAL FORCE-LONG-DISTANCE */int dialsrt = 1;			/* DIAL SORT ON */int dialrstr = 6;			/* DIAL RESTRICTION */int dialtest = 0;			/* DIAL TEST */int dialcount = 0;			/* \v(dialcount) */extern int dialsta;			/* Dial status */int dialrtr = -1,			/* Dial retries */    dialint = 10;			/* Dial retry interval */extern long dialcapas;			/* Modem capabilities */extern int dialcvt;			/* DIAL CONVERT-DIRECTORY */#endif /* NODIAL */#ifndef NOSPLint ifc,				/* IF case */    not = 0,				/* Flag for IF NOT */    ifargs = 0;				/* Count of IF condition words */char ifcond[100];			/* IF condition text */char *ifcp;				/* Pointer to IF condition text */#ifdef DCMDBUFextern int *ifcmd,  *count,  *iftest, *intime, *inpcas, *takerr, *merror, *xquiet;#elseextern int ifcmd[];			/* Last command was IF */extern int iftest[];			/* Last IF was true */extern int count[];			/* For IF COUNT, one for each cmdlvl */extern int intime[];			/* Ditto for other stackables... */extern int inpcas[];extern int takerr[];extern int merror[];extern int xquiet[];#endif /* DCMDBUF */#elseextern int takerr[];#endif /* NOSPL */#ifdef DCMDBUFextern char *line;			/* Character buffer for anything */extern char *tmpbuf;#elseextern char line[], tmpbuf[];#endif /* DCMDBUF */extern char *lp;			/* Pointer to line buffer */int cwdf = 0;				/* CWD has been done *//* Flags for ENABLE/DISABLE */extern int en_cwd, en_cpy, en_del, en_dir, en_fin,   en_get, en_hos, en_ren, en_sen, en_set, en_spa, en_typ, en_who, en_bye,   en_asg, en_que, en_ret, en_mai, en_pri, en_mkd, en_rmd, en_xit, en_ena;extern FILE *tfile[];			/* File pointers for TAKE command */extern char *tfnam[];			/* Names of TAKE files */extern int tfline[];			/* TAKE-file line number */extern int success;			/* Command success/failure flag */extern int cmdlvl;			/* Current position in command stack */#ifndef NOSPLextern int maclvl;			/* Macro to execute */extern char *macx[];			/* Index of current macro */extern char *mrval[];			/* Macro return value */extern char *macp[];			/* Pointer to macro */extern int macargc[];			/* ARGC from macro invocation */extern char *m_line[];extern char *m_arg[MACLEVEL][NARGS];	/* Stack of macro arguments */extern char *g_var[];			/* Global variables %a, %b, etc */#ifdef DCMDBUFextern struct cmdptr *cmdstk;		/* The command stack itself */#elseextern struct cmdptr cmdstk[];		/* The command stack itself */#endif /* DCMDBUF */#endif /* NOSPL */#define xsystem(s) zsyscmd(s)static int x, y, z = 0;static char *s, *p;#ifdef OS2_PROTOTYP( int os2settitle, (char *, int) );#endif /* OS2 */extern struct keytab yesno[], onoff[], fntab[];extern int nyesno, nfntab;#ifndef NOSPL/* Do the ASK, ASKQ, GETOK, and READ commands */int asktimedout = 0;#ifdef OS2static struct keytab asktab[] = {    "/popup", 1, 0};static int nasktab = 1;#endif /* OS2 */intdoask(cx) int cx; {    extern int cmflgs, asktimer, timelimit;#ifdef CK_RECALL    int sv_recall;    extern int on_recall;#endif /* CK_RECALL */#ifdef OS2    int popupflg = 0;#endif /* OS2 */    char vnambuf[VNAML+1];		/* Buffer for variable names */    char *vnp = NULL;			/* Pointer to same */#ifdef OS2    if (cx == XXASK || cx == XXASKQ) {	struct FDB sw, fl;	int getval;	char c;	cmfdbi(&sw,			/* First FDB - command switches */	       _CMKEY,			/* fcode */	       "Variable name or switch",	       "",			/* default */	       "",			/* addtl string data */	       nasktab,			/* addtl numeric data 1: tbl size */	       4,			/* addtl numeric data 2: 4 = cmswi */	       xxstring,		/* Processing function */	       asktab,			/* Keyword table */	       &fl			/* Pointer to next FDB */	       );	cmfdbi(&fl,			/* Anything that doesn't match */	       _CMFLD,			/* fcode */	       "",			/* hlpmsg */	       "",			/* default */	       "",			/* addtl string data */	       0,			/* addtl numeric data 1 */	       0,			/* addtl numeric data 2 */	       NULL,	       NULL,	       NULL	       );	while (1) {			/* Parse 0 or more switches */	    x = cmfdb(&sw);		/* Parse something */	    if (x < 0)	      return(x);	    if (cmresult.fcode != _CMKEY) /* Break out if not a switch */	      break;	    c = cmgbrk();	    if ((getval = (c == ':' || c == '=')) && !(cmgkwflgs() & CM_ARG)) {		printf("?This switch does not take an argument\n");		return(-9);	    }	    if (!getval && (cmgkwflgs() & CM_ARG)) {		printf("?This switch requires an argument\n");		return(-9);	    }	    switch (cmresult.nresult) {	      case 1: popupflg = 1; break;	      default: return(-2);	    }	}	/* Have variable name, make copy. */	ckstrncpy(vnambuf,cmresult.sresult,VNAML);	vnp = vnambuf;	if (vnambuf[0] == CMDQ &&	    (vnambuf[1] == '%' || vnambuf[1] == '&'))	  vnp++;	y = 0;	if (*vnp == '%' || *vnp == '&') {	    if ((y = parsevar(vnp,&x,&z)) < 0)	      return(y);	}    } else#endif /* OS2 */    if (cx != XXGOK && cx != XXRDBL) {	/* Get variable name */	if ((y = cmfld("Variable name","",&s,NULL)) < 0) {	    if (y == -3) {		printf("?Variable name required\n");		return(-9);	    } else return(y);	}	ckstrncpy(vnambuf,s,VNAML);	/* Make a copy. */	vnp = vnambuf;	if (vnambuf[0] == CMDQ &&	    (vnambuf[1] == '%' || vnambuf[1] == '&'))	  vnp++;	y = 0;	if (*vnp == '%' || *vnp == '&') {	    if ((y = parsevar(vnp,&x,&z)) < 0)	      return(y);	}    }    if (cx == XXREA || cx == XXRDBL) {	/* READ or READBLOCK command */	if ((y = cmcfm()) < 0)		/* Get confirmation */	  return(y);	if (chkfn(ZRFILE) < 1) {	/* File open? */	    printf("?Read file not open\n");	    return(success = 0);	}	if (!(s = (char *)readbuf)) {		/* Where to read into. */	    printf("?Oops, no READ buffer!\n");	    return(success = 0);	}	y = zsinl(ZRFILE, s, readblock); /* Read a line. */	debug(F111,"read zsinl",s,y);	if (y < 0) {			/* On EOF or other error, */	    zclose(ZRFILE);		/* close the file, */	    delmac(vnp);		/* delete the variable, */	    return(success = 0);	/* and return failure. */	} else {			/* Read was OK. */	    readsize = (int) strlen(s);	    success = (addmac(vnp,s) < 0 ? 0 : 1); /* Define variable */	    debug(F111,"read addmac",vnp,success);	    return(success);		/* Return success. */	}    }    /* ASK, ASKQ, GETOK, or GETC */    if ((y = cmtxt("Prompt, enclose in { braces } to preserve\n\leading and trailing spaces, precede question mark with backslash (\\).",		   "",&p,xxstring)) < 0) {	return(y);    }    if (!p) p = "";#ifdef OS2    if (popupflg) {			/* Popup requested */	ckstrncpy(tmpbuf,brstrip(p),TMPBUFSIZ);	p = tmpbuf;	if (cx == XXASK || cx == XXASKQ) {	    int rc;	    if (cx == XXASK)	      rc = popup_readtext(vmode,p,line,LINBUFSIZ,asktimer);	    else	      rc = popup_readpass(vmode,p,line,LINBUFSIZ,asktimer);            asktimedout = ( rc == -1 && asktimer );	}	y = addmac(vnp,(char *)line);	/* Add it to the macro table. */	timelimit = 0;	return(success = y < 0 ? 0 : 1);    }#endif /* OS2 */    concb((char)escape);		/* Enter CBREAK mode */    cmsavp(psave,PROMPTL);		/* Save old prompt */    cmsetp(brstrip(p));			/* Make new prompt */reprompt:    if (cx == XXASKQ) {			/* For ASKQ, */	cmini(0);			/* no-echo mode. */    } else {				/* For others, regular echoing. */	cmini(ckxech);    }    askflag = 1;    x = -1;				/* This means to reparse. */    cmflgs = 0;    if (pflag)      prompt(xxstring);			/* Issue prompt. */    asktimedout = 0;			/* Handle timed responses. */    if (asktimer > 0)      timelimit = asktimer;reparse:    cmres();    if (cx == XXGOK) {			/* GETOK */#ifdef CK_RECALL	sv_recall = on_recall;	on_recall = 0;#endif /* CK_RECALL */	x = cmkey(yesno,nyesno,"","",xxstring);	/* GETOK uses keyword table */	if (x < 0) {			/* Parse error */	    if (x == -10) {		x = 0;		printf("?Timed out, assuming \"No\"\n");		asktimedout = 1;		goto gokdone;	    } else if (x == -3) {	/* No answer? */		printf("Please respond Yes or No\n"); /* Make them answer */		cmini(ckxech);		goto reprompt;	    } else if (x == -1) {		goto reparse;	    } else	      goto reprompt;	}	if (cmcfm() < 0)		/* Get confirmation */	  goto reparse;  gokdone:	askflag = 0;	cmsetp(psave);			/* Restore prompt */#ifdef VMS	if (cmdlvl > 0)			/* In VMS and not at top level, */	  conres();			/*  restore console again. */#endif /* VMS */#ifdef CK_RECALL	on_recall = sv_recall;#endif /* CK_RECALL */	timelimit = 0;	return(x);			/* Return success or failure */    } else if (cx == XXGETC		/* GETC */#ifdef OS2	       || cx == XXGETK		/* or GETKEYCODE */#endif /* OS2 */	       ) { /* GETC */	char tmp[16];	conbin((char)escape);		/* Put keyboard in raw mode */#ifdef OS2	if (cx == XXGETK) {		/* GETKEYCODE */	    extern int os2gks;	    int t;	    t = os2gks;			/* Turn off kverb recognition */	    os2gks = 0;	    x = congks(timelimit);	/* Read a key event, blocking */	    os2gks = t;			/* Put back kverb recognition */	} else 				/* GETC */#endif /* OS2 */	  x = coninc(timelimit);	/* Just read one character */	concb((char)escape);		/* Put keyboard back in cbreak mode */	if (x > -1) {	    if (cmdsrc() == 0)	      printf("\r\n");#ifdef OS2	    if (cx == XXGETK) {		/* GETKEYCODE */		sprintf(tmp,"%d",x);	    } else {#endif /* OS2 */		tmp[0] = (char) (x & 0xff);		tmp[1] = NUL;#ifdef OS2	    }#endif /* OS2 */	    y = addmac(vnp,tmp);	/* Add it to the macro table. */	    debug(F111,"getc/getk addmac",vnp,y);	} else y = -1;	cmsetp(psave);			/* Restore old prompt. */	if (x < -1) {	    asktimedout = 1;	    if (!quiet)	      printf("?Timed out\n");	}	timelimit = 0;	return(success = y < 0 ? 0 : 1);    } else {				/* ASK or ASKQ */#ifdef CK_RECALL	sv_recall = on_recall;	on_recall = 0;#endif /* CK_RECALL */	y = cmdgquo();			/* Get current quoting */	cmdsquo(0);			/* Turn off quoting */	while (x == -1) {		/* Prompt till they answer */	    x = cmtxt("Please respond.","",&s,NULL);	    debug(F111,"ASK cmtxt",s,x);	    cmres();	}	cmdsquo(y);			/* Restore previous quoting */#ifdef CK_RECALL	on_recall = sv_recall;#endif /* CK_RECALL */	if (cx == XXASKQ)		/* ASKQ must echo CRLF here */	  printf("\r\n");	if (x < 0) {			/* If cmtxt parse error, */	    cmsetp(psave);		/* restore original prompt */#ifdef VMS	    if (cmdlvl > 0)		/* In VMS and not at top level, */	      conres();			/*  restore console again. */#endif /* VMS */	    if (x == -10) {		printf("?Timed out\n");		asktimedout = 1;		x = -9;	    }	    timelimit = 0;	    return(x);			/* and return cmtxt's error code. */	}	if (*s == NUL) {		/* If user typed a bare CR, */	    cmsetp(psave);		/* Restore old prompt, */	    delmac(vnp);		/* delete variable if it exists, */#ifdef VMS	    if (cmdlvl > 0)		/* In VMS and not at top level, */	      conres();			/*  restore console again. */#endif /* VMS */	    timelimit = 0;	    return(success = 1);	/* and return. */	}	y = addmac(vnp,s);		/* Add it to the macro table. */	debug(F111,"ask addmac",vnp,y);	cmsetp(psave);			/* Restore old prompt. */#ifdef VMS

⌨️ 快捷键说明

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