📄 ckuus6.c
字号:
#include "ckcsym.h"#ifndef NOICP/* C K U U S 6 -- "User Interface" for Unix Kermit (Part 6) *//* 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.*//* Includes */#include "ckcdeb.h"#include "ckcasc.h"#include "ckcker.h"#include "ckuusr.h"#include "ckcxla.h"#include "ckcnet.h" /* Network symbols */#include <signal.h>#ifdef VMS#ifndef TCPSOCKET#include <errno.h>#endif /* TCPSOCKET */#endif /* VMS */#ifdef datageneral#define fgets(stringbuf,max,fd) dg_fgets(stringbuf,max,fd)#endif /* datageneral */#ifdef QNX6#define readblock kreadblock#endif /* QNX6 *//* External Kermit Variables, see ckmain.c for description. */extern xx_strp xxstring;extern int local, xitsta, binary, parity, escape, flow, cmd_rows, turn, turnch, duplex, ckxech, seslog, dfloc, cnflg, tlevel, pflag, msgflg, mdmtyp, zincnt, quiet, repars, techo, network, nzxopts, what, filepeek, recursive;extern int xaskmore, tt_rows, tt_cols, cmd_cols, g_matchdot, diractive, xcmdsrc, nscanfile, reliable, nolinks;#ifdef VMSORUNIXextern int zgfs_dir, zgfs_link;#endif /* VMSORUNIX */#ifdef CK_IFRO extern int remonly;#endif /* CK_IFRO */#ifdef OS2extern int StartedFromDialer ;extern int vmode;extern int k95stdout;#ifndef NT#define INCL_NOPM#define INCL_VIO /* Needed for ckocon.h */#include <os2.h>#undef COMMENT#else#define APIRET ULONG#include <windows.h>#include <tapi.h>#include "ckntap.h"#endif /* NT */#include "ckocon.h"#endif /* OS2 */extern long vernum, speed;extern char *versio, *protv, *ckxv, *ckzv, *fnsv, *connv, *dftty, *cmdv;extern char *dialv, *loginv, *for_def[], *whil_def[], *xif_def[], *sw_def[];extern char *foz_def[];extern char *ckxsys, *ckzsys;#ifndef OS2extern char *DIRCMD;#ifndef UNIXextern char *DELCMD;#endif /* UNIX */#endif /* OS2 */extern char ttname[], filnam[];extern CHAR sstate, feol;extern char *zinptr;#ifdef UNIXextern char ** mtchs; /* zxpand() file list */#endif /* UNIX */#ifndef NOXFERextern int oopts, omode, oname, opath; /* O-Packet options */extern int stdinf, sndsrc, size, rpsiz, urpsiz, fncnv, fnrpath, displa, stdouf, isguest, pktlog, nfils, keep, maxrps, fblksiz, frecl, frecfm, atcapr, atdiso, spsizf, spsiz, spsizr, spmax, wslotr, prefixing, fncact, fnspath, nprotos, g_proto, g_urpsiz, g_spsizf, g_spsiz, g_spsizr, g_spmax, g_wslotr, g_prefixing, g_fncact, g_fncnv, g_fnspath, g_fnrpath, xfrxla, g_xfrxla;extern char *cmarg, *cmarg2;#ifndef NOMSEND /* Multiple SEND */extern char *msfiles[];#endif /* NOMSEND */extern char fspec[]; /* Most recent filespec */extern int fspeclen;#ifdef CK_TMPDIRextern int f_tmpdir; /* Directory changed temporarily */extern char savdir[]; /* For saving current directory */#endif /* CK_TMPDIR */extern struct keytab protos[]; /* File transfer protocols */extern struct ck_p ptab[NPROTOS];#endif /* NOXFER */#ifdef DCMDBUF /* Declarations from cmd package */extern char *cmdbuf, *atmbuf; /* Command buffers */#elseextern char cmdbuf[], atmbuf[]; /* Command buffers */#endif /* DCMDBUF */extern int nopush;#ifndef NOSPLint askflag = 0; /* ASK-class command active */extern char **a_ptr[];extern int a_dim[];extern char **m_xarg[];extern int n_xarg[];extern struct mtab *mactab;extern int nmac;extern long ck_alarm;extern char alrm_date[], alrm_time[];extern int x_ifnum;#endif /* NOSPL */extern int inserver; /* I am IKSD */extern int backgrd; /* Kermit executing in background */extern char psave[]; /* For saving & restoring prompt */extern char *tp; /* Temporary buffer */int readblock = 4096; /* READ buffer size */CHAR * readbuf = NULL; /* Pointer to read buffer */int readsize = 0; /* Number of chars actually read */int getcmd = 0; /* GET-class command was given */extern int zchkod, zchkid;struct keytab deltab[] = { /* DELETE Command Options */ { "/all", DEL_ALL, CM_INV }, { "/after", DEL_AFT, CM_ARG }, { "/ask", DEL_ASK, 0 }, { "/before", DEL_BEF, CM_ARG }, { "/directories", DEL_DIR, 0 }, { "/dotfiles", DEL_DOT, 0 }, { "/except", DEL_EXC, CM_ARG }, { "/heading", DEL_HDG, 0 }, { "/l", DEL_LIS, CM_INV|CM_ABR }, { "/larger-than", DEL_LAR, CM_ARG }, { "/list", DEL_LIS, 0 }, { "/log", DEL_LIS, CM_INV }, { "/noask", DEL_NAS, 0 }, { "/nodotfiles", DEL_NOD, 0 }, { "/noheading", DEL_NOH, 0 }, { "/nol", DEL_NOL, CM_INV|CM_ABR }, { "/nolist", DEL_NOL, 0 }, { "/nolog", DEL_NOL, CM_INV }, { "/nopage", DEL_NOP, 0 }, { "/not-after", DEL_NAF, CM_ARG }, { "/not-before", DEL_NBF, CM_ARG }, { "/not-since", DEL_NAF, CM_INV|CM_ARG }, { "/page", DEL_PAG, 0 }, { "/quiet", DEL_QUI, CM_INV }, { "/recursive", DEL_REC, 0 }, { "/simulate", DEL_SIM, 0 }, { "/since", DEL_AFT, CM_ARG|CM_INV }, { "/smaller-than", DEL_SMA, CM_ARG }, { "/summary", DEL_SUM, 0 }, { "/tree", DEL_ALL, 0 }, { "/type", DEL_TYP, CM_ARG }, { "/verbose", DEL_VRB, CM_INV }};int ndeltab = sizeof(deltab)/sizeof(struct keytab);/* /QUIET-/VERBOSE (/LIST-/NOLIST) (/LOG-/NOLOG) table */struct keytab qvswtab[] = { { "/l", DEL_LIS, CM_INV|CM_ABR }, { "/list", DEL_LIS, 0 }, { "/log", DEL_LIS, CM_INV }, { "/nol", DEL_NOL, CM_INV|CM_ABR }, { "/nolist", DEL_NOL, 0 }, { "/nolog", DEL_NOL, CM_INV }, { "/quiet", DEL_QUI, CM_INV }, { "/verbose", DEL_VRB, CM_INV }};int nqvswtab = sizeof(qvswtab)/sizeof(struct keytab);struct keytab copytab[] = { { "/append", 998, 0 },#ifndef NOSPL { "/fromb64", 997, 0 },#endif /* NOSPL */ { "/l", DEL_LIS, CM_INV|CM_ABR }, { "/list", DEL_LIS, 0 }, { "/log", DEL_LIS, CM_INV }, { "/nol", DEL_NOL, CM_INV|CM_ABR }, { "/nolist", DEL_NOL, 0 }, { "/nolog", DEL_NOL, CM_INV }, { "/quiet", DEL_QUI, CM_INV }, { "/swap-bytes", 999, 0 },#ifndef NOSPL { "/tob64", 996, 0 },#endif /* NOSPL */ { "/verbose", DEL_VRB, CM_INV }};int ncopytab = sizeof(copytab)/sizeof(struct keytab);#ifndef NOXFERstatic struct keytab gettab[] = { /* GET options */ { "/as-name", SND_ASN, CM_ARG }, { "/binary", SND_BIN, 0 },#ifdef CALIBRATE { "/calibrate", SND_CAL, CM_INV },#endif /* CALIBRATE */#ifdef PIPESEND { "/command", SND_CMD, CM_PSH },#endif /* PIPESEND */ { "/delete", SND_DEL, 0 }, { "/except", SND_EXC, CM_ARG }, { "/filenames", SND_NAM, CM_ARG },#ifdef PIPESEND { "/filter", SND_FLT, CM_ARG|CM_PSH },#endif /* PIPESEND */#ifdef VMS { "/image", SND_IMG, 0 }, { "/labeled", SND_LBL, 0 },#else { "/image", SND_BIN, CM_INV },#endif /* VMS */#ifdef CK_TMPDIR { "/move-to", SND_MOV, CM_ARG },#endif /* CK_TMPDIR */ { "/pathnames", SND_PTH, CM_ARG }, { "/pipes", SND_PIP, CM_ARG|CM_PSH }, { "/quiet", SND_SHH, 0 },#ifdef CK_RESEND { "/recover", SND_RES, 0 },#endif /* CK_RESEND */ { "/recursive", SND_REC, 0 }, { "/rename-to", SND_REN, CM_ARG },#ifdef COMMENT { "/smaller-than", SND_SMA, CM_ARG },#endif /* COMMENT */ { "/subdirectories", SND_REC, CM_INV }, { "/text", SND_TXT, 0 }, { "/transparent", SND_XPA, 0 }};#define NGETTAB sizeof(gettab)/sizeof(struct keytab)static int ngettab = NGETTAB;static struct keytab rcvtab[] = { /* RECEIVE options */ { "/as-name", SND_ASN, CM_ARG }, { "/binary", SND_BIN, 0 },#ifdef CALIBRATE { "/calibrate", SND_CAL, CM_INV },#endif /* CALIBRATE */#ifdef PIPESEND { "/command", SND_CMD, CM_PSH },#endif /* PIPESEND */ { "/except", SND_EXC, CM_ARG }, { "/filenames", SND_NAM, CM_ARG },#ifdef PIPESEND { "/filter", SND_FLT, CM_ARG|CM_PSH },#endif /* PIPESEND */#ifdef VMS { "/image", SND_IMG, 0 }, { "/labeled", SND_LBL, 0 },#else { "/image", SND_BIN, CM_INV },#endif /* VMS */#ifdef CK_TMPDIR { "/move-to", SND_MOV, CM_ARG },#endif /* CK_TMPDIR */ { "/pathnames", SND_PTH, CM_ARG }, { "/pipes", SND_PIP, CM_ARG|CM_PSH },#ifdef CK_XYZ { "/protocol", SND_PRO, CM_ARG },#else { "/protocol", SND_PRO, CM_ARG|CM_INV },#endif /* CK_XYZ */ { "/quiet", SND_SHH, 0 }, { "/recursive", SND_REC, 0 }, { "/rename-to", SND_REN, CM_ARG }, { "/text", SND_TXT, 0 }, { "/transparent", SND_XPA, 0 }};#define NRCVTAB sizeof(rcvtab)/sizeof(struct keytab)static int nrcvtab = NRCVTAB;#endif /* NOXFER *//* WAIT table */#define WAIT_FIL 997#define WAIT_MDM 998struct keytab waittab[] = { { "cd", BM_DCD, CM_INV }, /* (Carrier Detect) */ { "cts", BM_CTS, CM_INV }, /* (Clear To Send) */ { "dsr", BM_DSR, CM_INV }, /* (Data Set Ready) */ { "file", WAIT_FIL, 0 }, /* New category selector keywords */ { "modem-signals", WAIT_MDM, 0 }, /* ... */ { "ri", BM_RNG, CM_INV } /* (Ring Indicator) */};int nwaittab = (sizeof(waittab) / sizeof(struct keytab));/* Modem signal table */struct keytab mstab[] = { { "cd", BM_DCD, 0 }, /* Carrier Detect */ { "cts", BM_CTS, 0 }, /* Clear To Send */ { "dsr", BM_DSR, 0 }, /* Data Set Ready */ { "ri", BM_RNG, 0 } /* Ring Indicator */};int nms = (sizeof(mstab) / sizeof(struct keytab));#define WF_MOD 1#define WF_DEL 2#define WF_CRE 3struct keytab wfswi[] = { /* WAIT FILE switches */ { "creation", WF_CRE, 0 }, /* Wait for file to be created */ { "deletion", WF_DEL, 0 }, /* Wait for file to be deleted */ { "modification", WF_MOD, 0 } /* Wait for file to be modified */};int nwfswi = (sizeof(wfswi) / sizeof(struct keytab));#ifndef NOSPLstruct keytab asgtab[] = { /* Assignment operators for "." */ { "::=", 2, 0 }, /* ASSIGN and EVALUATE */ { ":=", 1, 0 }, /* ASSIGN */ { "=", 0, 0 } /* DEFINE */};int nasgtab = (sizeof(asgtab) / sizeof(struct keytab));struct keytab opntab[] = {#ifndef NOPUSH { "!read", OPN_PI_R, CM_INV }, { "!write", OPN_PI_W, CM_INV },#endif /* NOPUSH */ { "append", OPN_FI_A, 0 }, { "host", OPN_NET, 0 },#ifdef OS2 { "line", OPN_SER, CM_INV }, { "port", OPN_SER, 0 },#else { "line", OPN_SER, 0 }, { "port", OPN_SER, CM_INV },#endif /* OS2 */ { "read", OPN_FI_R, 0 }, { "write", OPN_FI_W, 0 }};int nopn = (sizeof(opntab) / sizeof(struct keytab));/* IF conditions */#define XXIFCO 0 /* IF COUNT */#define XXIFER 1 /* IF ERRORLEVEL */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -