📄 ckuusx.c
字号:
#include <setjmp.h>#endif /* NT */#include "ckcsig.h"extern ckjmpbuf cmjbuf;#endif /* NOCCTRAP */extern int xfiletype, nscanfile;intshoesc(escape) int escape; { extern char * ccntab[]; /* C0 control character name table */ extern int tt_escape; if ((escape > 0 && escape < 32) || (escape == 127)) { printf(" Escape character: Ctrl-%c (ASCII %d, %s): %s\r\n", ctl(escape), escape, (escape == 127 ? "DEL" : ccntab[escape]), tt_escape ? "enabled" : "disabled" ); } else { printf(" Escape character: Code %d",escape); if (escape > 160 && escape < 256) printf(" (%c)",escape); printf(": %s\r\n", tt_escape ? "enabled" : "disabled"); } return(0);}#ifndef NOXFER/* P R E S E T -- Reset global protocol variables */extern int recursive;#ifdef PATTERNSint patterns = SET_AUTO; /* Whether to use filename patterns */extern int g_patterns; /* For saving and restoring */#elseint patterns = SET_OFF;#endif /* PATTERNS */#ifndef NOICP#ifdef CK_LABELEDextern int g_lf_opts, lf_opts;#endif /* CK_LABELED */extern int g_matchdot, g_usepipes, usepipes;extern int g_binary, g_proto, g_displa, g_spath, g_rpath, g_fncnv;extern int g_recursive;extern int g_xfermode, xfermode;extern int g_urpsiz, g_spsizf, g_spsiz;extern int g_spsizr, g_spmax, g_wslotr, g_prefixing, g_fncact;extern int g_fnspath, g_fnrpath, g_skipbup;extern int nolinks;#ifdef CKSYMLINKextern int zgfs_link;#endif /* CKSYMLINK */#ifndef NOSPLextern int g_pflg, pwflg, g_pcpt, pwcrypt;extern char * g_pswd, pwbuf[];#endif /* NOSPL */#endif /* NOICP */extern int spsizf, spsizr, spmax, prefixing, fncact, fnspath, fnrpath;extern int moving; /* SEND criteria */extern char sndafter[], sndbefore[], *sndexcept[], *rcvexcept[];extern long sndlarger, sndsmaller, calibrate, skipbup;extern int rmailf, rprintf;extern char optbuf[];#ifdef PIPESENDextern char * g_sfilter, * g_rfilter;extern char * sndfilter, * rcvfilter;#endif /* PIPESEND */extern char ** sndarray;VOIDftreset() {#ifndef NOICP int i; extern char * filefile; extern int reliable, xreliable, c_save, ss_save, slostart, urclear; extern int oopts, omode, oname, opath, kactive, autopath; extern char * snd_move; /* Directory to move sent files to */ extern char * snd_rename; /* What to rename sent files to */ extern char * rcv_move; extern char * rcv_rename; extern char * g_snd_move; extern char * g_snd_rename; extern char * g_rcv_move; extern char * g_rcv_rename;#ifdef CK_TMPDIR extern int f_tmpdir; extern char savdir[];#endif /* CK_TMPDIR */#ifdef CK_SPEED#ifdef COMMENT extern int f_ctlp; extern short s_ctlp[], ctlp[];#endif /* COMMENT */#endif /* CK_SPEED */#ifndef NOCSETS extern int fcs_save, tcs_save; extern int g_xfrxla, xfrxla;#endif /* NOCSETS *//* Restore / reset per-command file-transfer switches */ makestr(&snd_move,g_snd_move); makestr(&rcv_move,g_rcv_move); makestr(&snd_rename,g_snd_rename); makestr(&rcv_rename,g_rcv_rename); kactive = 0; /* Kermit protocol no longer active */ oopts = -1; /* O-Packet Options */ omode = -1; /* O-Packet Transfer Mode */ oname = -1; /* O-Packet Filename Options */ opath = -1; /* O-Packet Pathname Options */#ifdef CK_RESEND rs_len = 0L; /* REGET position */#endif /* CK_RESEND */#ifdef COMMENT#ifdef CK_SPEED if (f_ctlp) { for (i = 0; i < 256; i++) ctlp[i] = s_ctlp[i]; f_ctlp = 0; }#endif /* CK_SPEED */#endif /* COMMENT */#ifdef CK_TMPDIR if (f_tmpdir) { /* If we changed to download dir */ zchdir((char *) savdir); /* Go back where we came from */ f_tmpdir = 0; }#endif /* CK_TMPDIR */ calibrate = 0L; /* Calibration run */ if (xreliable > -1) { reliable = xreliable; debug(F101,"ftreset reliable","",reliable); } urclear = 0; if (autopath) { /* SET RECEIVE PATHNAMES AUTO */ fnrpath = PATH_AUTO; autopath = 0; } if (filefile) { /* File list */ zclose(ZMFILE); makestr(&filefile,NULL); } if (c_save > -1) { /* Block Check Type */ bctr = c_save; c_save = -1; } if (ss_save > -1) { /* Slow Start */ slostart = ss_save; ss_save = -1; }#ifdef CK_LABELED if (g_lf_opts > -1) { lf_opts = g_lf_opts; /* Restore labeled transfer options */ g_lf_opts = -1; }#endif /* CK_LABELED */#ifndef NOCSETS if (tcs_save > -1) { /* Character sets */ tcharset = tcs_save; tcs_save = -1; } if (fcs_save > -1) { fcharset = fcs_save; fcs_save = -1; } if (g_xfrxla > -1) { xfrxla = g_xfrxla; g_xfrxla = -1; } setxlatype(tcharset,fcharset); /* Translation type */#endif /* NOCSETS */#ifdef NETCONN#ifndef NOSPL if (g_pswd) { ckstrncpy(pwbuf,g_pswd,PWBUFL); makestr(&g_pswd,NULL); } if (g_pflg > -1) { pwflg = g_pflg; g_pflg = -1; } if (g_pcpt > -1) { pwcrypt = g_pcpt; g_pcpt = -1; }#endif /* NOSPL */#endif /* NETCONN */ if (g_binary > -1) { /* File type */ binary = g_binary; g_binary = -1; } if (g_xfermode > -1) { /* Transfer mode */ xfermode = g_xfermode; g_xfermode = -1; }#ifdef PATTERNS if (g_patterns > -1) { /* Filename patterns */ patterns = g_patterns; g_patterns = -1; }#endif /* PATTERNS */ if (g_usepipes > -1) { usepipes = g_usepipes; g_usepipes = -1; } if (g_matchdot > -1) { matchdot = g_matchdot; g_matchdot = -1; } if (g_proto > -1) { /* Protocol */ protocol = g_proto; g_proto = -1; } if (g_urpsiz > -1) { urpsiz = g_urpsiz; debug(F101,"ftreset restoring urpsiz","",urpsiz); g_urpsiz = -1; } if (g_spsizf > -1) { spsizf = g_spsizf; debug(F101,"ftreset restoring spsizf","",spsizf); g_spsizf = -1; } if (g_spsiz > -1) { spsiz = g_spsiz; debug(F101,"ftreset restoring spsiz","",spsiz); g_spsiz = -1; } if (g_spsizr > -1) { spsizr = g_spsizr; debug(F101,"ftreset restoring spsizr","",spsizr); g_spsizr = -1; } if (g_spmax > -1) { spmax = g_spmax; g_spmax = -1; } if (g_wslotr > -1) { wslotr = g_wslotr; g_wslotr = -1; } if (g_prefixing > -1) { prefixing = g_prefixing; g_prefixing = -1; } if (g_fncact > -1) { fncact = g_fncact; g_fncact = -1; } if (g_fncnv > -1) { fncnv = g_fncnv; g_fncnv = -1; } if (g_fnspath > -1) { fnspath = g_fnspath; g_fnspath = -1; } if (g_fnrpath > -1) { fnrpath = g_fnrpath; g_fnrpath = -1; } if (g_skipbup > -1) { skipbup = g_skipbup; g_skipbup = -1; } nolinks = 2; /* /FOLLOWLINKS is never global */ recursive = 0; /* /RECURSIVE can never be global */ xfiletype = -1; if (g_displa > -1) { /* File transfer display */ fdispla = g_displa; g_displa = -1; } if (g_spath > -1) { /* Send pathnames */ fnspath = g_spath; g_spath = -1; } if (g_rpath > -1) { /* Receive pathnames */ fnrpath = g_rpath; g_rpath = -1; } if (g_fncnv > -1) { /* Filename conversion */ fncnv = g_fncnv; g_fncnv = -1; }#ifdef PIPESEND makestr(&sndfilter,g_sfilter); /* Send filter */ makestr(&rcvfilter,g_rfilter); /* Receive filter */#endif /* PIPESEND */#ifndef NOFRILLS rmailf = rprintf = 0; /* MAIL and PRINT modifiers for SEND */ optbuf[0] = NUL; /* MAIL and PRINT options */#endif /* NOFRILLS */ moving = 0; /* Reset delete-after-send indicator */ sndafter[0] = NUL; /* Reset SEND selection switches */ sndbefore[0] = NUL; for (i = 0; i < NSNDEXCEPT; i++) { if (sndexcept[i]) free(sndexcept[i]); sndexcept[i] = NULL; if (rcvexcept[i]) free(rcvexcept[i]); rcvexcept[i] = NULL; } sndlarger = -1L; sndsmaller = -1L;#ifdef GFTIMER gtv = -1.0; oldgtv = -1.0;#else gtv = -1L; oldgtv = -1L;#endif /* GFTIMER */#endif /* NOICP */}#endif /* NOXFER */char *ttgtpn() { /* Get typical port name *//* Ideally this routine would be implemented in each of the cku?io.* modules, but that requires changing the API definition.*/ return(#ifdef OS2#ifdef OS2ONLY"COM1"#else /* OS2ONLY */"TAPI [ name ] or COM1"#endif /* OS2ONLY */#else /* OS2 */#ifdef VMS"TXA0:, TTA0:, or LTA0:"#else /* VMS */#ifdef SOLARIS"/dev/cua/a"#else /* SOLARIS */#ifdef HPUX10"/dev/cua0p0"#else /* HPUX10 */#ifdef HPUX"/dev/cua00"#else /* HPUX */#ifdef __FreeBSD__"/dev/cuaa0"#else /* __FreeBSD__ */#ifdef __linux__"/dev/ttyS0"#else /* __linux__ */#ifdef BSD44"/dev/tty00"#else /* BSD44 */#ifdef OSK"/t1"#else /* OSK */#ifdef QNX"/dev/ser1"#else /* QNX */#ifdef QNX6"/dev/ser1"#else /* QNX6 */#ifdef UNIXWARE"/dev/term/00 or /dev/tty00"#else /* UNIXWARE */#ifdef CK_SCOV5"/dev/tty1A"#else /* CK_SCOV5 */#ifdef CK_SCO32V4"/dev/tty1A"#else /* CK_SCO32V4 */#ifdef M_XENIX"/dev/tty1A"#else /* M_XENIX */#ifdef AIXRS"/dev/tty0"#else /* AIXRS */#ifdef DGUX"/dev/tty00"#else /* DGUX */#ifdef datageneral"@con1"#else /* datageneral */#ifdef IRIX"/dev/ttym0"#else /* IRIX */#ifdef SUNOS4"/dev/ttyh0"#else /* SUNOS4 */#ifdef SV68R3V6"/dev/scc0"#else /* SV68R3V6 */#ifdef MOTSV88R4"/dev/contty00"#else /* MOTSV88R4 */#ifdef NEXT"/dev/cufa"#else#ifdef OSF"/dev/ttyd1"#else#ifdef SINIX"/dev/ttyc1"#else#ifdef UNIX"/dev/cua, /dev/acu, /dev/tty0, etc"#else /* UNIX */"(sorry no example available)"#endif /* UNIX */#endif /* SINIX */#endif /* OSF */#endif /* NEXT */#endif /* MOTSV88R4 */#endif /* SV68R3V6 */#endif /* SUNOS4 */#endif /* IRIX */#endif /* datageneral */#endif /* DGUX */#endif /* AIX */#endif /* M_XENIX */#endif /* CK_SCO32V4 */#endif /* CK_SCOV5 */#endif /* UNIXWARE */#endif /* QNX6 */#endif /* QNX */#endif /* OSK */#endif /* BSD44 */#endif /* __linux__ */#endif /* __FreeBSD__ */#endif /* HPUX */#endif /* HPUX10 */#endif /* SOLARIS */#endif /* VMS */#endif /* OS2 */ );}/* C K _ E R R S T R -- Return message from most recent system error */#ifdef CKROOTextern int ckrooterr;#endif /* CKROOT */char *ck_errstr() {#ifdef USE_STRERROR#ifndef CK_ANSILIBS /* Should have been declared in <string.h> */_PROTOTYP( char * strerror, (int) );#endif /* CK_ANSILIBS */#ifdef CKROOT if (ckrooterr) return("Off limits");#endif /* CKROOT */ return(strerror(errno));#else /* !USE_STRERROR */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -