📄 ckuusx.c
字号:
goto xscanfile; } } } /* Small file - not enough evidence unless ... */ if (bytes < 100) { if (oddzero != 0 && evenzero != 0) { debug(F100,"scanfile small UCS2 doubtful","",0); rc = FT_BIN; goto xscanfile; } else if (oddzero == 0 && evenzero == 0) { rc = eightbit ? FT_8BIT : FT_7BIT; } } goto xscanfile; /* Seems to be UCS-2 */ }/* If none of the above, it's probably not Unicode. */ if (!eightbit) { /* It's 7-bit */ if (c0controls) { /* This would be strange */ if ((c0noniso > 0) && (txtcz == 0)) { debug(F100,"scanfile 7-bit BIN (c0coniso)","",0); rc = FT_BIN; } else { debug(F100,"scanfile 7-bit ISO2022 TEXT (no c0noniso)","",0); rc = FT_7BIT; } } else { /* 7-bit text */ debug(F100,"scanfile 7-bit TEXT (no c0controls)","",0); rc = FT_7BIT; } } else if (!c0noniso || txtcz) { /* 8-bit text */ debug(F100,"scanfile 8-bit TEXT (no c0noniso)","",0); rc = FT_8BIT; val = c1controls ? 1 : 0; } else { /* 8-bit binary */ debug(F100,"scanfile 8-bit BIN (c0noniso)","",0); rc = FT_BIN; }#else /* !UNICODE */ if (c0noniso) { debug(F100,"scanfile 8-bit BIN (c0noniso)","",0); rc = FT_BIN; } else if (eightbit) { debug(F100,"scanfile 8-bit TEXT (no c0noniso)","",0); rc = FT_8BIT; val = c1controls ? 1 : 0; } else { debug(F100,"scanfile 7-bit TEXT (no c0noniso)","",0); rc = FT_7BIT; }#endif /* UNICODE */ xscanfile: if (flag) *flag = val; debug(F101,"scanfile result ","",rc); return(rc);}/* F I L E S E L E C T -- Select this file for sending */int#ifdef CK_ANSICfileselect( char *f, char *sa, char *sb, char *sna, char *snb, long minsiz, long maxsiz, int nbu, int nxlist, char ** xlist)#elsefileselect(f,sa,sb,sna,snb,minsiz,maxsiz,nbu,nxlist,xlist) char *f,*sa,*sb,*sna,*snb; long minsiz,maxsiz; int nbu,nxlist; char ** xlist;#endif /* CK_ANSIC *//* fileselect */ { char *fdate; int n; long z; if (!sa) sa = ""; if (!sb) sb = ""; if (!sna) sna = ""; if (!snb) snb = "";#ifdef CKSYMLINK#ifndef NOICP#ifndef NOXFER if (nolinks) { long zz; zz = zgetfs(f); debug(F111,"fileselect NOLINKS zgetfs",f,zz); if (zz < 0L) return(0); debug(F111,"fileselect NOLINKS zgfs_link",f,zgfs_link); if (zgfs_link) return(0); }#endif /* NOXFER */#endif /* NOICP */#endif /* CKSYMLINK */ debug(F110,"fileselect",f,0); if (*sa || *sb || *sna || *snb) { fdate = zfcdat(f); /* Date/time of this file */ if (!fdate) fdate = ""; n = strlen(fdate); debug(F111,"fileselect fdate",fdate,n); if (n != 17) /* Failed to get it */ return(1); /* /AFTER: */ if (sa[0] && (strcmp(fdate,(char *)sa) <= 0)) { debug(F110,"fileselect sa",sa,0); /* tlog(F110,"Skipping (too old)",f,0); */ return(0); } /* /BEFORE: */ if (sb[0] && (strcmp(fdate,(char *)sb) >= 0)) { debug(F110,"fileselect sb",sb,0); /* tlog(F110,"Skipping (too new)",f,0); */ return(0); } /* /NOT-AFTER: */ if (sna[0] && (strcmp(fdate,(char *)sna) > 0)) { debug(F110,"fileselect sna",sna,0); /* tlog(F110,"Skipping (too new)",f,0); */ return(0); } /* /NOT-BEFORE: */ if (snb[0] && (strcmp(fdate,(char *)snb) < 0)) { debug(F110,"fileselect snb",snb,0); /* tlog(F110,"Skipping (too old)",f,0); */ return(0); } } if (minsiz > -1L || maxsiz > -1L) { /* Smaller or larger */ z = zchki(f); /* Get size */ debug(F101,"fileselect filesize","",z); if (z < 0) return(1); if ((minsiz > -1L) && (z >= minsiz)) { debug(F111,"fileselect minsiz skipping",f,minsiz); /* tlog(F111,"Skipping (too big)",f,z); */ return(0); } if ((maxsiz > -1L) && (z <= maxsiz)) { debug(F111,"fileselect maxsiz skipping",f,maxsiz); /* tlog(F110,"Skipping (too small)",f,0); */ return(0); } } if (nbu) { /* Skipping backup files? */ if (ckmatch(#ifdef CKREGEX "*.~[0-9]*~" /* Not perfect but close enough. */#else "*.~*~" /* Less close. */#endif /* CKREGEX */ ,f,filecase,1)) { debug(F110,"fileselect skipping backup",f,0); return(0); } } for (n = 0; xlist && n < nxlist; n++) { if (!xlist[n]) { debug(F101,"fileselect xlist empty",0,n); break; } if (ckmatch(xlist[n],f,filecase,1)) { debug(F111,"fileselect xlist",xlist[n],n); debug(F110,"fileselect skipping",f,0); return(0); } } if (xfiletype > -1) { n = scanfile(f,NULL,nscanfile); if (n < 0) { n = binary ? 1 : 0; } else { n = (n == FT_BIN) ? 1 : 0; } if (n != xfiletype) return(0); } debug(F110,"fileselect selecting",f,0); return(1);}#ifdef TCPSOCKET#ifdef NTextern int WSASafeToCancel;#endif /* NT */#endif /* TCPSOCKET */VOIDsetflow() { extern int flow, autoflow, mdmtyp, cxtype, cxflow[];#ifndef NODIAL extern int dialcapas, dialfc; extern MDMINF * modemp[]; MDMINF * p = NULL; long bits = 0;#endif /* NODIAL */ debug(F101,"setflow autoflow","",autoflow);/* #ifdef COMMENT *//* WHY WAS THIS COMMENTED OUT? */ if (!autoflow) /* Only if FLOW is AUTO */ return;/* #endif */ /* COMMENT */ debug(F101,"setflow local","",local); debug(F101,"setflow network","",network); debug(F101,"setflow cxtype","",cxtype);#ifdef TN_COMPORT if (network && istncomport()) { flow = cxflow[CXT_MODEM]; debug(F101,"setflow TN_COMPORT flow","",flow); return; }#endif /* TN_COMPORT */ if (network || !local || cxtype == CXT_DIRECT) { flow = cxflow[cxtype]; /* Set appropriate flow control */ debug(F101,"setflow flow","",flow); return; } if (cxtype != CXT_MODEM) /* Connection type should be modem */ return;#ifndef NODIAL bits = dialcapas; /* Capability bits */ if (!bits) { /* No bits? */ p = modemp[mdmtyp]; /* Look in modem info structure */ if (p) bits = p->capas; } if (dialfc == FLO_AUTO) { /* If DIAL flow is AUTO */#ifdef CK_RTSCTS /* If we can do RTS/CTS flow control */ if (bits & CKD_HW) /* and modem can do it too */ flow = FLO_RTSC; /* then switch to RTS/CTS */ else /* otherwise */ flow = FLO_XONX; /* use Xon/Xoff. */#else#ifndef NEXT#ifndef IRIX flow = FLO_XONX; /* Use Xon/Xoff. */#endif /* IRIX */#endif /* NEXT */#endif /* CK_RTSCTS */ }#endif /* NODIAL */ debug(F101,"setflow modem flow","",flow); return;}#ifndef NOLOCAL#ifdef CK_TRIGGER/* A U T O E X I T C H K -- Check for CONNECT-mode trigger string *//* Returns -1 if trigger not found, or else the trigger index, 0 or greater. (Replace with fancier and more efficient matcher later...) NOTE: to prevent unnecessary function call overhead, call this way: x = tt_trigger[0] ? autoexitchk(c) : -1;*/int#ifdef CK_ANSICautoexitchk(CHAR c)#elseautoexitchk(c) CHAR c;#endif /* CK_ANSIC *//* autoexitchk */ { extern CHAR * tt_trmatch[]; extern char * tt_trigger[]; int i; for (i = 0; i < TRIGGERS; i++) { if (!tt_trigger[i]) { /* No more triggers in list */ break; } else if (*tt_trigger[i]) { if (!tt_trmatch[i]) /* Just starting? */ tt_trmatch[i] = (CHAR *)tt_trigger[i]; /* Set match pointer */ if (c == *tt_trmatch[i]) { /* Compare this character */ tt_trmatch[i]++; /* It matches */ if (!*tt_trmatch[i]) { /* End of match string? */ tt_trmatch[i] = (CHAR *) tt_trigger[i]; /* Yes, rewind, */ debug(F101,"autoexitchk",tt_trigger[i],i); /* log, */ return(i); /* and return success */ } } else /* No match */ tt_trmatch[i] = (CHAR *) tt_trigger[i]; /* Rewind match string */ } /* and go on the next match string */ } return(-1); /* No match found */}#endif /* CK_TRIGGER */#ifndef NOSHOW/* S H O M D M -- Show modem signals */VOIDshomdm() {/* Note use of "\r\n" to make sure this report prints right, even when called during CONNECT mode.*/ int y; y = ttgmdm(); switch (y) { case -3: printf( "Modem signals unavailable in this version of Kermit\r\n"); break; case -2: printf("No modem control for this device\r\n"); break; case -1: printf("Modem signals unavailable\r\n"); break; default:#ifndef MAC printf( " Carrier Detect (CD): %s\r\n",(y & BM_DCD) ? "On": "Off"); printf( " Dataset Ready (DSR): %s\r\n",(y & BM_DSR) ? "On": "Off");#endif /* MAC */ printf( " Clear To Send (CTS): %s\r\n",(y & BM_CTS) ? "On": "Off");#ifndef STRATUS#ifndef MAC printf( " Ring Indicator (RI): %s\r\n",(y & BM_RNG) ? "On": "Off");#endif /* MAC */ printf( " Data Terminal Ready (DTR): %s\r\n",#ifdef NT "(unknown)"#else /* NT */ (y & BM_DTR) ? "On": "Off"#endif /* NT */ );#ifndef MAC printf( " Request To Send (RTS): %s\r\n",#ifdef NT "(unknown)"#else /* NT */ (y & BM_RTS) ? "On": "Off"#endif /* NT */ );#endif /* MAC */#endif /* STRATUS */ }#ifdef BETADEBUG#ifdef CK_TAPI if (tttapi && !tapipass) { LPDEVCFG lpDevCfg = NULL; LPCOMMCONFIG lpCommConfig = NULL; LPMODEMSETTINGS lpModemSettings = NULL; DCB * lpDCB = NULL; if (cktapiGetModemSettings(&lpDevCfg,&lpModemSettings, &lpCommConfig,&lpDCB)) { printf("\n"); cktapiDisplayModemSettings(lpDevCfg,lpModemSettings, lpCommConfig,lpDCB); } }#endif /* CK_TAPI */#endif /* BETADEBUG */}#endif /* NOSHOW */#endif /* NOLOCAL */#ifndef NOXFER/* S D E B U -- Record spar results in debugging log */VOIDsdebu(len) int len; { debug(F111,"spar: data",(char *) rdatap,len); debug(F101," spsiz ","", spsiz); debug(F101," timint","",timint); debug(F101," npad ","", npad); debug(F101," padch ","", padch); debug(F101," seol ","", seol); debug(F101," ctlq ","", ctlq); debug(F101," ebq ","", ebq); debug(F101," ebqflg","",ebqflg); debug(F101," bctr ","", bctr); debug(F101," rptq ","", rptq); debug(F101," rptflg","",rptflg); debug(F101," lscapu","",lscapu); debug(F101," atcapu","",atcapu); debug(F101," lpcapu","",lpcapu); debug(F101," swcapu","",swcapu); debug(F101," wslotn","", wslotn); debug(F101," whatru","", whatru);}/* R D E B U -- Debugging display of rpar() values */VOIDrdebu(d,len) CHAR *d; int len; { debug(F111,"rpar: data",d,len); debug(F101," rpsiz ","", xunchar(d[0])); debug(F101," rtimo ","", rtimo); debug(F101," mypadn","",mypadn); debug(F101," mypadc","",mypadc); debug(F101," eol ","", eol); debug(F101," ctlq ","", ctlq); debug(F101," sq ","", sq); debug(F101," ebq ","", ebq); debug(F101," ebqflg","",ebqflg); debug(F101," bctr ","", bctr); debug(F101," rptq ","", d[8]); debug(F101," rptflg","",rptflg); debug(F101," capas ","", capas); debug(F101," bits ","",d[capas]); debug(F101," lscapu","",lscapu); debug(F101," atcapu","",atcapu); debug(F101," lpcapu","",lpcapu); debug(F101," swcapu","",swcapu); debug(F101," wslotr","", wslotr); debug(F101," rpsiz(extended)","",rpsiz);}#ifdef COMMENT/* C H K E R R -- Decide whether to exit upon a protocol error */VOIDchkerr() { if (backgrd && !server) fatal("Protocol error");}#endif /* COMMENT */#endif /* NOXFER *//* F A T A L -- Fatal error message */VOIDfatal(msg) char *msg; { extern int initflg; static int initing = 0; if (!msg) msg = ""; debug(F111,"fatal",msg,initflg); if (!initflg) { /* If called from prescan */ if (initing) /* or called from sysinit() */ exit(253); initing = 1; sysinit(); } debug(F111,"fatal",msg,xitsta); tlog(F110,"Fatal:",msg,0L);#ifdef VMS if (strncmp(msg,"%CKERMIT",8)) conol("%CKERMIT-E-FATAL, "); conoll(msg);#else /* !VMS */ conoll(msg);#endif /* VMS */#ifdef OS2#ifndef NOXFER if (xfrbel) { bleep(BP_FAIL); sleep(1); bleep(BP_FAIL); }#endif /* NOXFER */#endif /* OS2 */ doexit(BAD_EXIT,xitsta | 1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -