📄 ckuus7.c
字号:
#include "ckcsym.h"/* C K U U S 7 -- "User Interface" for C-Kermit, part 7 *//* 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.*//* This file created from parts of ckuus3.c, which became too big for Mark Williams Coherent compiler to handle.*//* Definitions here supersede those from system include files.*/#include "ckcdeb.h" /* Debugging & compiler things */#include "ckcasc.h" /* ASCII character symbols */#include "ckcker.h" /* Kermit application definitions */#include "ckcxla.h" /* Character set translation */#include "ckcnet.h" /* Network symbols */#include "ckuusr.h" /* User interface symbols */#include "ckucmd.h"#include "ckclib.h"#ifdef VMS#ifndef TCPSOCKET#include <errno.h>#endif /* TCPSOCKET */#endif /* VMS */#ifdef OS2#ifndef NT#define INCL_NOPM#define INCL_VIO /* Needed for ckocon.h */#define INCL_DOSMODULEMGR#include <os2.h>#undef COMMENT#else /* NT */#define APIRET ULONG#include <windows.h>#include <tapi.h>#include "cknwin.h"#include "ckntap.h"#endif /* NT */#include "ckowin.h"#include "ckocon.h"#include "ckodir.h"#ifdef OS2MOUSE#include "ckokey.h"#endif /* OS2MOUSE */#ifdef KUI#include "ikui.h"#endif /* KUI */#ifdef putchar#undef putchar#endif /* putchar */#define putchar(x) conoc(x)extern int mskkeys;#endif /* OS2 */#ifdef CK_AUTHENTICATION#include "ckuath.h"#endif /* CK_AUTHENTICATION */#ifdef CK_SSL#include "ck_ssl.h"#endif /* CK_SSL */#ifdef SSHBUILTIN#include "ckossh.h"#endif /* SSHBUILTIN */#ifdef STRATUS /* Stratus Computer, Inc. VOS */#ifdef putchar#undef putchar#endif /* putchar */#define putchar(x) conoc(x)#ifdef getchar#undef getchar#endif /* getchar */#define getchar(x) coninc(0)#endif /* STRATUS */char * slmsg = NULL;static int x, y = 0, z;static char *s;extern CHAR feol;extern int g_matchdot, hints, xcmdsrc, rcdactive;extern char * k_info_dir;#ifndef NOSPLextern int nmac;extern struct mtab *mactab;#endif /* NOSPL */#ifndef NOXFER#ifdef CK_SPEEDextern short ctlp[]; /* Control-char prefixing table */#endif /* CK_SPEED */#ifdef PIPESENDextern char * sndfilter, * g_sfilter;extern char * rcvfilter, * g_rfilter;#endif /* PIPESEND */extern char * snd_move;extern char * snd_rename;extern char * g_snd_move;extern char * g_snd_rename;extern char * rcv_move;extern char * rcv_rename;extern char * g_rcv_move;extern char * g_rcv_rename;#ifdef PATTERNSextern char *binpatterns[], *txtpatterns[];extern int patterns;#endif /* PATTERNS */extern char * remdest;#ifdef CK_TMPDIRchar * dldir = NULL;#endif /* CK_TMPDIR */extern struct ck_p ptab[];extern int protocol, remfile, rempipe, remappd, reliable, xreliable, fmask, fncnv, frecl, maxrps, wslotr, bigsbsiz, bigrbsiz, urpsiz, rpsiz, spsiz, bctr, npad, timef, timint, spsizr, spsizf, maxsps, spmax, nfils, displa, atcapr, pkttim, rtimo, fncact, mypadn, fdispla, f_save, pktpaus, setreliable, fnrpath, fnspath, atenci, atenco, atdati, atdato, atleni, atleno, atblki, atblko, attypi, attypo, atsidi, atsido, atsysi, atsyso, atdisi, atdiso;extern int stathack;extern int atfrmi, atfrmo;#ifdef STRATUSextern int atcrei, atcreo, atacti, atacto;#endif /* STRATUS */#ifdef CK_PERMSextern int atlpri, atlpro, atgpri, atgpro;#endif /* CK_PERMS */extern CHAR sstate, eol, seol, stchr, mystch, mypadc, padch, ctlq, myctlq;#ifdef IKSDextern int inserver;#ifdef IKSDCONFextern int iksdcf;#endif /* IKSDCONF */#endif /* IKSD */extern char *cmarg, *cmarg2;#ifndef NOFRILLSextern char optbuf[]; /* Buffer for MAIL or PRINT options */extern int rprintf; /* REMOTE PRINT flag */#endif /* NOFRILLS */#endif /* NOXFER */#ifdef CK_TRIGGERextern char * tt_trigger[];#endif /* CK_TRIGGER */extern int tcs_transp;#ifdef PCTERMextern int tt_pcterm;#endif /* PCTERM */#ifdef NTextern int tt_vtnt;#endif /* NT */#ifdef SSHBUILTINint sl_ssh_xfw = 0;int sl_ssh_xfw_saved = 0;int sl_ssh_ver = 0;int sl_ssh_ver_saved = 0;#endif /* SSHBUILTIN */#ifdef CK_AUTHENTICATIONextern int auth_type_user[];int sl_auth_type_user[AUTHTYPLSTSZ] = {AUTHTYPE_NULL, AUTHTYPE_NULL};int sl_auth_saved = 0;int sl_topt_a_su = 0;int sl_topt_a_s_saved = 0;int sl_topt_a_cm = 0;int sl_topt_a_c_saved = 0;#endif /* CK_AUTHENTICATION */#ifdef CK_ENCRYPTIONextern int cx_type;int sl_cx_type = 0;int sl_cx_saved = 0;int sl_topt_e_su = 0;int sl_topt_e_sm = 0;int sl_topt_e_s_saved = 0;int sl_topt_e_cu = 0;int sl_topt_e_cm = 0;int sl_topt_e_c_saved = 0;#endif /* CK_ENCRYPTION */extern char uidbuf[];static int uidflag = 0;char sl_uidbuf[UIDBUFLEN] = { NUL, NUL };int sl_uid_saved = 0;#ifdef TNCODEint sl_tn_wait = 0;int sl_tn_saved = 0;#endif /* TNCODE */#ifdef TNCODEextern int tn_wait_flg;#endif /* TNCODE */VOIDslrestor() {#ifdef CK_AUTHENTICATION int x; if (sl_auth_saved) { for (x = 0; x < AUTHTYPLSTSZ; x++) auth_type_user[x] = sl_auth_type_user[x]; sl_auth_saved = 0; } if (sl_topt_a_s_saved) { TELOPT_DEF_S_U_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_su; sl_topt_a_s_saved = 0; } if (sl_topt_a_c_saved) { TELOPT_DEF_C_ME_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_cm; sl_topt_a_c_saved = 0; }#endif /* CK_AUTHENTICATION */#ifdef CK_ENCRYPTION if (sl_cx_saved) { cx_type = sl_cx_type; sl_cx_saved = 0; } if (sl_topt_e_s_saved) { TELOPT_DEF_S_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_su; TELOPT_DEF_S_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_sm; sl_topt_e_s_saved = 0; } if (sl_topt_e_c_saved) { TELOPT_DEF_C_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cu; TELOPT_DEF_C_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cm; sl_topt_e_c_saved = 0; }#endif /* CK_ENCRYPTION */ if (sl_uid_saved) { ckstrncpy(uidbuf,sl_uidbuf,UIDBUFLEN); sl_uid_saved = 0; }#ifdef TNCODE if (sl_tn_saved) { tn_wait_flg = sl_tn_wait; sl_tn_saved = 0; }#endif /* TNCODE */#ifdef SSHBUILTIN if (sl_ssh_xfw_saved) { ssh_xfw = sl_ssh_xfw; sl_ssh_xfw_saved = 0; } if (sl_ssh_ver_saved) { ssh_ver = sl_ssh_ver; sl_ssh_ver_saved = 0; }#endif /* SSHBUILTIN */}int oldplex = -1; /* Duplex holder around network */#ifndef NOICP#ifdef LOCUSextern int locus, autolocus;#endif /* LOCUS */#ifndef NODIALextern int dialsta;#endif /* NODIAL *//* Note: gcc -Wall wants braces around each keyword table entry. */static struct keytab psltab[] = { /* SET LINE/PORT command options */ { "/connect", SL_CNX, 0 },#ifdef OS2ORVMS { "/noshare", SL_NSH, 0 },#endif /* OS2ORVMS */ { "/server", SL_SRV, 0 },#ifdef OS2ORVMS { "/share", SL_SHR, 0 },#endif /* OS2ORVMS */ { "", 0, 0 }};static int npsltab = sizeof(psltab)/sizeof(struct keytab) - 1;#ifdef NETCONNstatic struct keytab shtab[] = { /* SET HOST command options */#ifdef NETCMD /* (COMMAND is also a network type) */ { "/command", SL_CMD, CM_INV },#endif /* NETCMD */ { "/connect", SL_CNX, 0 }, { "/network-type", SL_NET, CM_ARG }, { "/nowait", SL_NOWAIT, 0 },#ifndef NOSPL#ifdef CK_AUTHENTICATION { "/password", SL_PSW, CM_ARG },#endif /* CK_AUTHENTICATION */#endif /* NOSPL */#ifdef NETCMD { "/pipe", SL_CMD, 0 },#endif /* NETCMD */#ifdef NETPTY { "/pty", SL_PTY, 0 },#endif /* NETPTY */ { "/server", SL_SRV, 0 }, { "/timeout", SL_TMO, CM_ARG }, { "/userid", SL_UID, CM_ARG }, { "/wait", SL_WAIT, 0 }, { "", 0, 0 }};static int nshtab = sizeof(shtab)/sizeof(struct keytab) - 1;static struct keytab shteltab[] = { /* TELNET command options */#ifdef CK_AUTHENTICATION { "/auth", SL_AUTH, CM_ARG },#endif /* CK_AUTHENTICATION */#ifdef CK_ENCRYPTION { "/encrypt", SL_ENC, CM_ARG },#endif /* CK_ENCRYPTION */ { "/nowait", SL_NOWAIT, 0 },#ifndef NOSPL#ifdef CK_AUTHENTICATION { "/password", SL_PSW, CM_ARG },#endif /* CK_AUTHENTICATION */#endif /* NOSPL */ { "/timeout", SL_TMO, CM_ARG }, { "/userid", SL_UID, CM_ARG }, { "/wait", SL_WAIT, 0 }, { "", 0 ,0 }};static int nshteltab = sizeof(shteltab)/sizeof(struct keytab) - 1;#ifdef RLOGCODEstatic struct keytab shrlgtab[] = { /* SET HOST RLOGIN command options */#ifdef CK_KERBEROS#ifdef CK_ENCRYPTION { "/encrypt", SL_ENC, 0 },#endif /* CK_ENCRYPTION */ { "/k4", SL_KRB4, CM_INV }, { "/k5", SL_KRB5, CM_INV }, { "/kerberos4", SL_KRB4, 0 }, { "/kerberos5", SL_KRB5, 0 }, { "/kerberos_iv", SL_KRB4, CM_INV }, { "/kerberos_v", SL_KRB5, CM_INV }, { "/krb4", SL_KRB4, CM_INV }, { "/krb5", SL_KRB5, CM_INV },#endif /* CK_KERBEROS */ { "", 0 ,0 }};static int nshrlgtab = sizeof(shrlgtab)/sizeof(struct keytab)-1;#endif /* RLOGCODE */extern struct keytab netcmd[];extern int nnets;#ifndef NODIALextern int dirline;extern int nnetdir; /* Network services directory */extern char *netdir[];_PROTOTYP( VOID ndreset, (void) );char *nh_p[MAXDNUMS + 1]; /* Network directory entry pointers */char *nh_p2[MAXDNUMS + 1]; /* Network directory entry nettype */char *nh_px[4][MAXDNUMS + 1]; /* Network-specific stuff... */#endif /* NODIAL */int nhcount = 0;int ndinited = 0;char * n_name = NULL; /* Network name pointer */#endif /* NETCONN */_PROTOTYP(int remtxt, (char **) );_PROTOTYP(VOID rmsg, (void) );_PROTOTYP(static int remcfm, (void) );extern int nopush;int mdmsav = -1; /* Save modem type around network */extern int isguest; /* Global flag for anonymous login */extern xx_strp xxstring;extern int success, binary, b_save, ckwarn, msgflg, quiet, cmask, pflag, local, nettype, escape, mdmtyp, duplex, dfloc, network, cdtimo, autoflow, tnlm, sosi, tlevel, lf_opts, backgrd, flow, debses, parity, ttnproto, ckxech, x_ifnum, cmflgs, haveline, cxtype, cxflow[], maclvl;#ifdef DCMDBUFextern struct cmdptr *cmdstk; /* The command stack itself */#elseextern struct cmdptr cmdstk[]; /* The command stack itself */#endif /* DCMDBUF */extern FILE * tfile[];extern char * macp[];extern char psave[]; /* For saving & restoring prompt */extern int sprmlen, rprmlen;#ifdef OS2static struct keytab strmkeytab[] = { { "clear", 0, 0 }, { "default", 1, 0 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -