ckuus7.c
资源名称:cku197.tar.Z [点击查看]
上传用户:dufan58
上传日期:2007-01-05
资源大小:3407k
文件大小:362k
源码类别:
通讯/手机编程
开发平台:
Windows_Unix
- #include "ckcsym.h"
- #ifndef NOICP
- /* C K U U S 7 -- "User Interface" for C-Kermit, part 7 */
- /*
- Author: Frank da Cruz <fdc@columbia.edu>,
- Columbia University Academic Information Systems, New York City.
- Copyright (C) 1985, 2000,
- 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"
- #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 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 char * tmpslmsg = NULL;
- static int x, y = 0, z;
- static char *s;
- extern CHAR feol;
- extern int g_matchdot, saveask, hints;
- extern char * k_info_dir;
- #ifndef NOSPL
- extern int nmac;
- extern struct mtab *mactab;
- #endif /* NOSPL */
- #ifndef NOXFER
- #ifdef CK_SPEED
- extern short ctlp[]; /* Control-char prefixing table */
- #endif /* CK_SPEED */
- #ifdef PIPESEND
- extern char * sndfilter;
- extern char * rcvfilter;
- #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 PATTERNS
- extern char *binpatterns[], *txtpatterns[];
- extern int patterns;
- #endif /* PATTERNS */
- extern char * remdest;
- #ifdef CK_TMPDIR
- char * 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;
- #ifdef STRATUS
- extern int atfrmi, atfrmo, atcrei, atcreo, atacti, atacto;
- #endif /* STRATUS */
- #ifdef CK_PERMS
- extern int atlpri, atlpro, atgpri, atgpro;
- #endif /* CK_PERMS */
- extern CHAR
- sstate, eol, seol, stchr, mystch, mypadc, padch, ctlq, myctlq;
- #ifdef IKSD
- extern int inserver;
- #ifdef IKSDCONF
- extern int iksdcf;
- #endif /* IKSDCONF */
- #endif /* IKSD */
- extern char *cmarg, *cmarg2;
- #ifndef NOFRILLS
- extern char optbuf[]; /* Buffer for MAIL or PRINT options */
- extern int rprintf; /* REMOTE PRINT flag */
- #endif /* NOFRILLS */
- #endif /* NOXFER */
- #ifdef CK_TRIGGER
- extern char * tt_trigger[];
- #endif /* CK_TRIGGER */
- extern int tcs_transp;
- #ifdef PCTERM
- extern int tt_pcterm;
- #endif /* PCTERM */
- #ifdef NT
- extern int tt_vtnt;
- #endif /* NT */
- /* Note: gcc -Wall wants braces around each keyword table entry. */
- static struct keytab psltab[] = { /* SET LINE/PORT command options */
- { "/connect", SL_CNX, 0 },
- #ifdef VMS
- { "/noshare", SL_NSH, 0 },
- #endif /* VMS */
- { "/server", SL_SRV, 0 },
- #ifdef VMS
- { "/share", SL_SHR, 0 },
- #endif /* VMS */
- { "", 0, 0 }
- };
- static int npsltab = sizeof(psltab)/sizeof(struct keytab) - 1;
- #ifdef NETCONN
- static struct keytab shtab[] = { /* SET HOST command options */
- #ifdef NETCMD
- "/command", SL_CMD, CM_INV, /* (COMMAND is also a network type) */
- #endif /* NETCMD */
- "/connect", SL_CNX, 0,
- "/network-type", SL_NET, CM_ARG,
- "/nowait", SL_NOWAIT, 0,
- #ifndef NOSPL
- "/password", SL_PSW, CM_ARG,
- #endif /* NOSPL */
- #ifdef NETCMD
- "/pipe", SL_CMD, 0,
- #endif /* NETCMD */
- #ifdef NETPTY
- "/pty", SL_PTY, 0,
- #endif /* NETPTY */
- "/server", SL_SRV, 0,
- "/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
- "/password", SL_PSW, CM_ARG,
- #endif /* NOSPL */
- "/userid", SL_UID, CM_ARG,
- "/wait", SL_WAIT, 0,
- "", 0 ,0
- };
- static int nshteltab = sizeof(shteltab)/sizeof(struct keytab) - 1;
- #ifdef RLOGCODE
- static 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 NODIAL
- extern 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 */
- static int oldplex = -1; /* Duplex holder around network */
- #endif /* NETCONN */
- _PROTOTYP(static 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[];
- extern char psave[]; /* For saving & restoring prompt */
- extern int sprmlen, rprmlen;
- #ifdef OS2
- static struct keytab strmkeytab[] = {
- "clear", 0, 0,
- "default", 1, 0
- };
- static int nstrmkeytab = sizeof(strmkeytab)/sizeof(struct keytab);
- static struct keytab strmswitab[] = {
- "/literal", 0, 0
- };
- static int nstrmswitab = sizeof(strmswitab)/sizeof(struct keytab);
- static struct keytab normrev[] = {
- "dark-display", 0, 0,
- "light-display", 1, 0,
- "normal", 0, 0,
- "reverse", 1, 0
- };
- static struct keytab prnmtab[] = {
- "auto", 1, 0,
- "copy", 2, 0,
- "off", 0, 0,
- "on", 1, CM_INV, /* Compatibility with XPRINT version */
- "transparent", 3, 0
- };
- static int nprnmtab = sizeof(prnmtab)/sizeof(struct keytab);
- extern int tt_diff_upd;
- #ifdef NT
- #define stricmp _stricmp
- extern int tt_attr_bug;
- #endif /* NT */
- extern int tt_rows[], tt_cols[];
- extern int tt_cols_usr;
- extern int tt_szchng[VNUM];
- int tt_modechg = TVC_ENA;
- extern struct _vtG G[4];
- extern int priority;
- extern bool send_c1;
- int send_c1_usr = FALSE;
- extern int sgrcolors;
- extern int marginbell, marginbellcol;
- extern int autoscroll, wy_autopage;
- extern int tt_sac;
- extern int dec_nrc, dec_lang, dec_kbd;
- #else /* OS2 */
- extern int tt_rows, tt_cols;
- #endif /* OS2 */
- extern int tt_escape;
- extern long speed;
- extern char *dftty;
- extern char *tp, *lp; /* Temporary buffer & pointers */
- extern char ttname[];
- int tttapi = 0; /* is Line TAPI? */
- struct keytab * tapilinetab = NULL;
- struct keytab * _tapilinetab = NULL;
- int ntapiline = 0;
- #ifdef NETCONN /* Network items */
- #ifdef ANYX25
- extern int revcall, closgr, cudata, nx25;
- extern char udata[];
- extern struct keytab x25tab[];
- #ifndef IBMX25
- extern int npadx3;
- extern CHAR padparms[];
- extern struct keytab padx3tab[];
- #endif /* IBMX25 */
- #endif /* ANYX25 */
- #ifdef OS2
- #ifndef NT
- extern bool ttslip,ttppp;
- #endif /* NT */
- #endif /* OS2 */
- #ifdef NPIPE
- extern char pipename[];
- #endif /* NPIPE */
- #ifdef TCPSOCKET
- static struct keytab tcprawtab[] = { /* SET HOST options */
- "/default", NP_DEFAULT, CM_INV,
- #ifdef CK_AUTHENTICATION
- #ifdef CK_KERBEROS
- #ifdef RLOGCODE
- "/ek4login", NP_EK4LOGIN, 0,
- "/ek5login", NP_EK5LOGIN, 0,
- "/k4login", NP_K4LOGIN, 0,
- "/k5login", NP_K5LOGIN, 0,
- #endif /* RLOGCODE */
- #endif /* CK_KERBEROS */
- #endif /* CK_AUTHENTICATION */
- "/no-telnet-init", NP_NONE, 0,
- "/none", NP_NONE, CM_INV,
- "/raw-socket", NP_TCPRAW, 0,
- #ifdef RLOGCODE
- "/rlogin", NP_RLOGIN, 0,
- #endif /* RLOGCODE */
- #ifdef CK_SSL
- "/ssl", NP_SSL, 0,
- "/ssl-telnet", NP_SSL_TELNET, 0,
- #endif /* CK_SSL */
- "/telnet", NP_TELNET, 0,
- #ifdef CK_SSL
- "/tls", NP_TLS, 0,
- "/tls-telnet", NP_TLS_TELNET, 0,
- #endif /* CK_SSL */
- "", 0, 0
- };
- static int ntcpraw = (sizeof(tcprawtab) / sizeof(struct keytab)) - 1;
- #ifdef RLOGCODE
- _PROTOTYP( int rlog_naws, (void) );
- #endif /* RLOGCODE */
- #endif /* TCPSOCKET */
- #ifdef SUPERLAT
- extern char slat_pwd[18];
- #endif /* SUPERLAT */
- #endif /* NETCONN */
- #ifdef TNCODE
- extern int tn_wait_flg;
- #endif /* TNCODE */
- #ifdef COMMENT
- #ifndef NOSETKEY
- extern KEY *keymap;
- #ifndef OS2
- #define mapkey(x) keymap[x]
- #endif /* OS2 */
- extern MACRO *macrotab;
- _PROTOTYP( VOID shostrdef, (CHAR *) );
- #ifndef NOKVERBS
- extern struct keytab kverbs[];
- extern int nkverbs;
- #endif /* NOKVERBS */
- #endif /* NOSETKEY */
- #else
- #ifndef NOSETKEY
- extern KEY *keymap;
- extern MACRO *macrotab;
- _PROTOTYP( VOID shostrdef, (CHAR *) );
- #ifndef NOKVERBS
- extern struct keytab kverbs[];
- extern int nkverbs;
- #endif /* NOKVERBS */
- #endif /* NOSETKEY */
- #endif /* COMMENT */
- #ifdef OS2 /* AUTODOWNLOAD parameters */
- extern int adl_kmode, adl_zmode; /* Match Packet to signal download */
- extern char * adl_kstr; /* KERMIT Download String */
- extern char * adl_zstr; /* ZMODEM Download String */
- extern int adl_kc0, adl_zc0; /* Process ADL C0s in emulation */
- #endif /* OS2 */
- /* Keyword tables ... */
- extern struct keytab onoff[], rltab[];
- extern int nrlt;
- /* SET FILE parameters */
- static struct keytab filtab[] = {
- #ifndef NOXFER
- #ifdef PATTERNS
- "binary-patterns", XYFIBP, 0,
- #endif /* PATTERNS */
- "bytesize", XYFILS, 0,
- #ifndef NOCSETS
- "character-set", XYFILC, 0,
- #endif /* NOCSETS */
- "collision", XYFILX, 0,
- "destination", XYFILY, 0,
- "display", XYFILD, CM_INV,
- #ifdef CK_TMPDIR
- "download-directory", XYFILG, 0,
- #endif /* CK_TMPDIR */
- #endif /* NOXFER */
- "end-of-line", XYFILA, 0,
- "eol", XYFILA, CM_INV,
- #ifdef CK_CTRLZ
- "eof", XYFILV, 0,
- #endif /* CK_CTRLZ */
- "fastlookups", 9997, CM_INV,
- #ifndef NOXFER
- "incomplete", XYFILI, 0,
- #ifdef CK_LABELED
- "label", XYFILL, 0,
- #endif /* CK_LABELED */
- "names", XYFILN, 0,
- #ifdef UNIX
- "output", XYFILH, 0,
- #endif /* UNIX */
- #ifdef PATTERNS
- "patterns", XYFIPA, 0,
- #endif /* PATTERNS */
- #ifdef VMS
- "record-length", XYFILR, 0,
- #endif /* VMS */
- #ifdef PATTERNS
- "text-patterns", XYFITP, 0,
- #endif /* PATTERNS */
- #endif /* NOXFER */
- "type", XYFILT, 0,
- #ifdef UNICODE
- "ucs", XYFILU, 0,
- #endif /* UNICODE */
- #ifndef NOXFER
- "warning", XYFILW, CM_INV
- #endif /* NOXFER */
- };
- static int nfilp = (sizeof(filtab) / sizeof(struct keytab));
- struct keytab pathtab[] = {
- "absolute", PATH_ABS, 0,
- "none", PATH_OFF, CM_INV,
- "off", PATH_OFF, 0,
- "on", PATH_ABS, CM_INV,
- "relative", PATH_REL, 0
- };
- int npathtab = (sizeof(pathtab) / sizeof(struct keytab));
- struct keytab rpathtab[] = {
- "absolute", PATH_ABS, 0,
- "auto", PATH_AUTO, 0,
- "none", PATH_OFF, CM_INV,
- "off", PATH_OFF, 0,
- "on", PATH_ABS, CM_INV,
- "relative", PATH_REL, 0
- };
- int nrpathtab = (sizeof(rpathtab) / sizeof(struct keytab));
- #ifdef CK_CTRLZ
- struct keytab eoftab[] = { /* EOF detection method */
- "ctrl-z", 1, 0,
- "length", 0, 0,
- "noctrl-z", 0, CM_INV
- };
- #endif /* CK_CTRLZ */
- struct keytab fttab[] = { /* File types for SET FILE TYPE */
- "ascii", XYFT_T, CM_INV,
- #ifdef VMS
- "b", XYFT_B, CM_INV|CM_ABR,
- #endif /* VMS */
- "binary", XYFT_B, 0,
- #ifdef VMS
- "block", XYFT_I, CM_INV,
- "image", XYFT_I, 0,
- #endif /* VMS */
- #ifdef CK_LABELED
- "labeled", XYFT_L, 0,
- #endif /* CK_LABELED */
- #ifdef MAC
- "macbinary", XYFT_M, 0,
- #endif /* MAC */
- "text", XYFT_T, 0
- };
- int nfttyp = (sizeof(fttab) / sizeof(struct keytab));
- static struct keytab rfttab[] = { /* File types for REMOTE SET FILE */
- "ascii", XYFT_T, CM_INV,
- "binary", XYFT_B, 0,
- #ifdef VMS
- "labeled", XYFT_L, 0,
- #else
- #ifdef OS2
- "labeled", XYFT_L, 0,
- #endif /* OS2 */
- #endif /* VMS */
- "text", XYFT_T, 0
- };
- static int nrfttyp = (sizeof(rfttab) / sizeof(struct keytab));
- #ifdef OS2ORUNIX
- #define ZOF_BLK 0
- #define ZOF_NBLK 1
- #define ZOF_BUF 2
- #define ZOF_NBUF 3
- static struct keytab zoftab[] = {
- "blocking", ZOF_BLK, 0,
- "buffered", ZOF_BUF, 0,
- "nonblocking", ZOF_NBLK, 0,
- "unbuffered", ZOF_NBUF, 0
- };
- static int nzoftab = (sizeof(zoftab) / sizeof(struct keytab));
- #endif /* OS2ORUNIX */
- #ifdef CK_AUTHENTICATION
- extern 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_ENCRYPTION
- extern 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 TNCODE
- int sl_tn_wait = 0;
- int sl_tn_saved = 0;
- #endif /* TNCODE */
- extern int query; /* Global flag for QUERY active */
- #ifndef NOSPL
- #ifndef NOXFER
- static struct keytab vartyp[] = { /* Variable types for REMOTE QUERY */
- "global", (int) 'G', CM_INV,
- "kermit", (int) 'K', 0,
- "system", (int) 'S', 0,
- "user", (int) 'G', 0
- };
- static int nvartyp = (sizeof(vartyp) / sizeof(struct keytab));
- #endif /* NOXFER */
- #endif /* NOSPL */
- #ifdef CK_TIMERS
- static struct keytab timotab[] = { /* Timer types */
- "dynamic", 1, 0,
- "fixed", 0, 0
- };
- #endif /* CK_TIMERS */
- #ifdef DCMDBUF
- extern char *atxbuf, *atmbuf; /* Atom buffer */
- extern char *cmdbuf; /* Command buffer */
- extern char *line, *tmpbuf; /* Character buffers for anything */
- extern int *intime; /* INPUT TIMEOUT */
- #else /* Not DCMDBUF ... */
- extern char atxbuf[], atmbuf[]; /* Atom buffer */
- extern char cmdbuf[]; /* Command buffer */
- extern char line[], tmpbuf[]; /* Character buffer for anything */
- extern int intime[];
- #endif /* DCMDBUF */
- #ifndef NOCSETS
- extern struct keytab fcstab[]; /* For SET FILE CHARACTER-SET */
- extern struct csinfo fcsinfo[]; /* File character set info. */
- extern struct keytab ttcstab[];
- extern int nfilc, fcharset, tcharset, ntermc, tcsr, tcsl;
- #ifdef CKOUNI
- extern int tt_utf8;
- #endif /* CKOUNI */
- #ifdef OS2
- _PROTOTYP( int os2setcp, (int) );
- _PROTOTYP( int os2getcp, (void) );
- _PROTOTYP( void os2debugoff, (void) );
- #endif /* OS2 */
- #endif /* NOCSETS */
- extern int cmdlvl; /* Overall command level */
- #ifndef NOSPL
- #ifdef DCMDBUF
- extern int *inpcas; /* INPUT CASE setting on cmd stack */
- #else
- extern int inpcas[];
- #endif /* DCMDBUF */
- #endif /* NOSPL */
- #ifdef CK_CURSES
- #ifndef VMS
- _PROTOTYP(int tgetent,(char *, char *));
- #else
- #ifdef __DECC
- _PROTOTYP(int tgetent,(char *, char *));
- #endif /* __DECC */
- #endif /* VMS */
- #endif /* CK_CURSES */
- #ifndef NOXMIT
- #define XMITF 0 /* SET TRANSMIT values */
- #define XMITL 1 /* (Local to this module) */
- #define XMITP 2
- #define XMITE 3
- #define XMITX 4
- #define XMITS 5
- #define XMITW 6
- #define XMITT 7
- #define XMBUFL 50
- extern int xmitf, xmitl, xmitp, xmitx, xmits, xmitw, xmitt;
- char xmitbuf[XMBUFL+1] = { NUL }; /* TRANSMIT eof string */
- struct keytab xmitab[] = { /* SET TRANSMIT */
- "echo", XMITX, 0,
- "eof", XMITE, 0,
- "fill", XMITF, 0,
- "linefeed", XMITL, 0,
- "locking-shift", XMITS, 0,
- "pause", XMITW, 0,
- "prompt", XMITP, 0,
- "timeout", XMITT, 0
- };
- int nxmit = (sizeof(xmitab) / sizeof(struct keytab));
- #endif /* NOXMIT */
- /* For SET FILE COLLISION */
- /* Some of the following may be possible for some C-Kermit implementations */
- /* but not others. Those that are not possible for your implementation */
- /* should be ifdef'd out. */
- struct keytab colxtab[] = { /* SET FILE COLLISION options */
- #ifndef MAC
- "append", XYFX_A, 0, /* append to old file */
- #endif /* MAC */
- #ifdef COMMENT
- "ask", XYFX_Q, 0, /* ask what to do (not implemented) */
- #endif
- "backup", XYFX_B, 0, /* rename old file */
- #ifndef MAC
- /* This crashes Mac Kermit. */
- "discard", XYFX_D, 0, /* don't accept new file */
- "no-supersede", XYFX_D, CM_INV, /* ditto (MSK compatibility) */
- #endif /* MAC */
- "overwrite", XYFX_X, 0, /* overwrite the old file == file warning off */
- "rename", XYFX_R, 0 /* rename the incoming file == file warning on */
- #ifndef MAC
- /* This crashes Mac Kermit. */
- , "update", XYFX_U, 0 /* replace if newer */
- #endif /* MAC */
- };
- int ncolx = (sizeof(colxtab) / sizeof(struct keytab));
- static struct keytab rfiltab[] = { /* for REMOTE SET FILE */
- #ifndef NOCSETS
- "character-set", XYFILC, 0,
- #endif /* NOCSETS */
- "collision", XYFILX, 0,
- "incomplete", XYFILI, 0,
- "names", XYFILN, 0,
- "record-length", XYFILR, 0,
- "type", XYFILT, 0
- };
- int nrfilp = (sizeof(rfiltab) / sizeof(struct keytab));
- struct keytab eoltab[] = { /* File eof delimiters */
- "cr", XYFA_C, 0,
- "crlf", XYFA_2, 0,
- "lf", XYFA_L, 0
- };
- static int neoltab = (sizeof(eoltab) / sizeof(struct keytab));
- struct keytab fntab[] = { /* File naming */
- "converted", XYFN_C, 0,
- "literal", XYFN_L, 0,
- "standard", XYFN_C, CM_INV
- };
- int nfntab = (sizeof(fntab) / sizeof(struct keytab));
- #ifndef NOLOCAL
- /* Terminal parameters table */
- static struct keytab trmtab[] = {
- #ifdef OS2
- "answerback", XYTANS, 0,
- #endif /* OS2 */
- #ifdef CK_APC
- "apc", XYTAPC, 0,
- #endif /* CK_APC */
- #ifdef OS2
- "arrow-keys", XYTARR, 0,
- #endif /* OS2 */
- #ifdef NT
- "at", XYTATTR, CM_INV|CM_ABR,
- "att", XYTATTR, CM_INV|CM_ABR,
- "attr", XYTATTR, CM_INV|CM_ABR,
- "attr-bug", XYTATTBUG, CM_INV,
- #endif /* NT */
- #ifdef OS2
- "attribute", XYTATTR, 0,
- #endif /* OS2 */
- #ifdef CK_APC
- #ifdef CK_AUTODL
- "autodownload", XYTAUTODL, 0,
- #endif /* CK_AUTODL */
- #endif /* CK_APC */
- #ifdef OS2
- "autopage", XYTAPAGE, 0,
- "autoscroll", XYTASCRL, 0,
- "bell", XYTBEL, CM_INV,
- #endif /* OS2 */
- "bytesize", XYTBYT, 0,
- #ifndef NOCSETS
- #ifndef KUI
- #ifdef OS2
- "character-set", XYTCS, CM_INV,
- #else /* OS2 */
- "character-set", XYTCS, 0,
- #endif /* OS2 */
- #endif /* KUI */
- #endif /* NOCSETS */
- #ifdef OS2
- "code-page", XYTCPG, 0,
- "color", XYTCOL, 0,
- "controls", XYTCTRL, 0,
- #endif /* OS2 */
- "cr-display", XYTCRD, 0,
- #ifdef OS2
- "cursor", XYTCUR, 0,
- #endif /* OS2 */
- "debug", XYTDEB, 0,
- #ifdef OS2
- "dg-unix-mode", XYTUNX, 0,
- #endif /* OS2 */
- "echo", XYTEC, 0,
- "escape-character", XYTESC, 0,
- #ifdef OS2
- #ifdef PCFONTS
- "font", XYTFON, 0,
- #endif /* PCFONTS */
- #endif /* OS2 */
- "height", XYTHIG, 0,
- #ifdef OS2
- "idle-send", XYTIDLE,0,
- #ifndef NOCSETS
- "kbd-follows-gl/gr", XYTKBDGL, 0,
- #endif /* NOCSETS */
- "key", XYTKEY, 0,
- "keyboard-mode", XYTKBMOD, 0,
- "keypad-mode", XYTKPD, 0,
- #endif /* OS2 */
- #ifndef NOCSETS
- #ifdef OS2
- "local-character-set", XYTLCS, 0,
- #else
- "local-character-set", XYTLCS, CM_INV,
- #endif /* OS2 */
- #endif /* NOCSETS */
- "locking-shift", XYTSO, 0,
- #ifdef OS2
- "margin-bell", XYTMBEL, 0,
- #endif /* OS2 */
- #ifdef OS2MOUSE
- "mouse", XYTMOU, CM_INV,
- #endif /* OS2MOUSE */
- "newline-mode", XYTNL, 0,
- #ifdef OS2
- "output-pacing", XYTPAC, 0,
- #ifdef PCTERM
- "pcterm", XYTPCTERM, 0,
- #endif /* PCTERM */
- #endif /* OS2 */
- #ifdef OS2ORUNIX
- "print", XYTPRN, 0,
- #endif /* OS2ORUNIX */
- #ifndef NOCSETS
- #ifdef OS2
- "remote-character-set", XYTRCS, 0,
- #else
- "remote-character-set", XYTRCS, CM_INV,
- #endif /* OS2 */
- #endif /* NOCSETS */
- #ifdef OS2
- "roll-mode", XYTROL, 0,
- "s", XYTUPD, CM_ABR|CM_INV,
- "sc", XYTUPD, CM_ABR|CM_INV,
- "scr", XYTUPD, CM_ABR|CM_INV,
- "scree", XYTUPD, CM_ABR|CM_INV,
- "screen", XYTUPD, CM_ABR|CM_INV,
- "screen-", XYTUPD, CM_ABR|CM_INV,
- "screen-mode", XYTSCNM, 0,
- "screen-optimize", XYTOPTI, 0,
- "screen-update", XYTUPD, 0,
- "scrollback", XYSCRS, 0,
- "send-data", XYTSEND, 0,
- "send-end-of-block", XYTSEOB, 0,
- "sgr-colors", XYTSGRC, 0,
- "sni-ch.code", XYTSNICC, 0,
- "sni-firmware-versions", XYTSNIFV, 0,
- "sni-language", XYTVTLNG, 0,
- "sni-pagemode", XYTSNIPM, CM_INV,
- "sni-scrollmode",XYTSNISM, CM_INV,
- "spacing-attribute-character", XYTSAC, CM_INV,
- "statusline", XYTSTAT, 0,
- "transmit-timeout", XYTCTS, 0,
- #endif /* OS2 */
- #ifdef CK_TRIGGER
- "trigger", XYTRIGGER, 0,
- #endif /* CK_TRIGGER */
- #ifdef OS2
- "type", XYTTYP, 0,
- #else
- "type", XYTTYP, CM_INV,
- #endif /* OS2 */
- #ifndef NOCSETS
- #ifdef UNICODE
- "unicode", XYTUNI, CM_INV,
- #endif /* UNICODE */
- #endif /* NOCSETS */
- #ifdef OS2
- "unix-mode", XYTUNX, CM_INV,
- #ifdef NT
- "video-change", XYTVCH, 0,
- #endif /* NT */
- "vt-language", XYTVTLNG, 0,
- "vt-nrc-mode", XYTVTNRC, 0,
- #endif /* OS2 */
- "width", XYTWID, 0,
- #ifdef OS2
- "wrap", XYTWRP, 0,
- #endif /* OS2 */
- "", 0, 0
- };
- int ntrm = (sizeof(trmtab) / sizeof(struct keytab)) - 1;
- #ifdef OS2
- struct keytab termctrl[] = { /* SET TERM CONTROLS */
- "7", 7, 0,
- "8", 8, 0
- };
- int ntermctrl = (sizeof(termctrl) / sizeof(struct keytab));
- struct keytab rolltab[] = { /* Set TERM Roll Options */
- "insert", TTR_INSERT, 0,
- "off", TTR_OVER, CM_INV,
- "on", TTR_INSERT, CM_INV,
- "overwrite", TTR_OVER, 0
- };
- int nroll = (sizeof(rolltab) / sizeof(struct keytab));
- #define TT_GR_ALL 4
- #define TT_GR_G0 0
- #define TT_GR_G1 1
- #define TT_GR_G2 2
- #define TT_GR_G3 3
- #define TT_GR_KBD 4
- struct keytab graphsettab[] = { /* DEC VT Graphic Sets */
- "all", TT_GR_ALL, 0,
- "g0", TT_GR_G0, 0,
- "g1", TT_GR_G1, 0,
- "g2", TT_GR_G2, 0,
- "g3", TT_GR_G3, 0,
- "keyboard", TT_GR_KBD, 0,
- "", 0, 0
- };
- int ngraphset = (sizeof(graphsettab) / sizeof(struct keytab)) - 1;
- struct keytab adltab[] = { /* Autodownload Options */
- "kermit", TAD_K, 0,
- "off", TAD_OFF, 0,
- "on", TAD_ON, 0,
- "zmodem", TAD_Z, 0
- };
- int nadltab = (sizeof(adltab) / sizeof(struct keytab));
- struct keytab adlxtab[] = { /* Autodownload Options */
- "c0-conflicts", TAD_X_C0, 0,
- "detection-method", TAD_X_DETECT, 0,
- "string", TAD_X_STR, 0
- };
- int nadlxtab = (sizeof(adlxtab) / sizeof(struct keytab));
- struct keytab adldtab[] = { /* Auto-dl Detection Methods */
- "packet", ADL_PACK, 0,
- "string", ADL_STR, 0
- };
- int nadldtab = (sizeof(adldtab) / sizeof(struct keytab));
- struct keytab adlc0tab[] = { /* Auto-dl Detection Methods */
- "ignored-by-emulator", 0, 0,
- "processed-by-emulator", 1, 0
- };
- int nadlc0tab = (sizeof(adlc0tab) / sizeof(struct keytab));
- struct keytab vtlangtab[] = {
- "belgian", VTL_BELGIAN , 0,
- "british", VTL_BRITISH , 0,
- "canadian", VTL_CANADIAN, 0,
- "czech", VTL_CZECH , 0,
- "danish", VTL_DANISH , 0,
- "dutch", VTL_DUTCH , 0,
- "finnish", VTL_FINNISH , 0,
- "french", VTL_FRENCH , 0,
- "french-canadian",VTL_FR_CAN , 0,
- "german", VTL_GERMAN , 0,
- "greek", VTL_GREEK , 0,
- "hebrew", VTL_HEBREW , 0,
- "hungarian", VTL_HUNGARIA, 0,
- "italian", VTL_ITALIAN , 0,
- "latin-american", VTL_LATIN_AM, 0,
- "north-american", VTL_NORTH_AM, 0,
- "norwegian", VTL_NORWEGIA, 0,
- "polish", VTL_POLISH , 0,
- "portugese", VTL_PORTUGES, 0,
- "romanian", VTL_ROMANIAN, 0,
- "russian", VTL_RUSSIAN , 0,
- "scs", VTL_SCS , CM_INV,
- "slovak", VTL_SLOVAK , 0,
- "spanish", VTL_SPANISH , 0,
- "swedish", VTL_SWEDISH , 0,
- "swiss-french", VTL_SW_FR , 0,
- "swiss-german", VTL_SW_GR , 0,
- "turkish-f", VTL_TURK_F , CM_INV,
- "turkish-q", VTL_TURK_Q , CM_INV
- };
- int nvtlangtab = (sizeof(vtlangtab) / sizeof(struct keytab));
- #endif /* OS2 */
- struct keytab crdtab[] = { /* Carriage-return display */
- "crlf", 1, 0,
- "normal", 0, 0
- };
- extern int tt_crd; /* Carriage-return display variable */
- #ifdef CK_APC
- extern int apcstatus, apcactive;
- static struct keytab apctab[] = { /* Terminal APC parameters */
- "off", APC_OFF, 0,
- "on", APC_ON, 0,
- "unchecked", APC_UNCH, 0
- };
- #endif /* CK_APC */
- #endif /* NOLOCAL */
- extern int autodl;
- struct keytab beltab[] = { /* Terminal bell mode */
- #ifdef OS2
- "audible", XYB_AUD, 0,
- "none", XYB_NONE, 0,
- #else
- "audible", XYB_AUD, CM_INV,
- "none", XYB_NONE, CM_INV,
- #endif /* OS2 */
- #ifdef OS2
- "off", XYB_NONE, CM_INV,
- "on", XYB_AUD, CM_INV,
- #else
- "off", XYB_NONE, 0,
- "on", XYB_AUD, 0,
- #endif /* OS2 */
- #ifdef OS2
- "visible", XYB_VIS, 0,
- #endif /* OS2 */
- "", 0, 0
- };
- int nbeltab = sizeof(beltab)/sizeof(struct keytab) - 1;
- int tt_unicode = 1; /* Use Unicode if possible */
- #ifdef OS2
- /*
- OS/2 serial communication devices.
- */
- struct keytab os2devtab[] = {
- "1", 1, CM_INV, /* Invisible synonyms, like */
- "2", 2, CM_INV, /* "set port 1" */
- "3", 3, CM_INV,
- "4", 4, CM_INV,
- "5", 5, CM_INV,
- "6", 6, CM_INV,
- "7", 7, CM_INV,
- "8", 8, CM_INV,
- "com1", 1, 0, /* Real device names */
- "com2", 2, 0,
- "com3", 3, 0,
- "com4", 4, 0,
- "com5", 5, 0,
- "com6", 6, 0,
- "com7", 7, 0,
- "com8", 8, 0
- #ifdef OS2ONLY
- ,"slipcom1", 1, 0, /* For use with SLIP driver */
- "slipcom2", 2, 0, /* shared access */
- "slipcom3", 3, 0,
- "slipcom4", 4, 0,
- "slipcom5", 5, 0,
- "slipcom6", 6, 0,
- "slipcom7", 7, 0,
- "slipcom8", 8, 0,
- "pppcom1", 1, 0, /* For use with PPP driver */
- "pppcom2", 2, 0, /* shared access */
- "pppcom3", 3, 0,
- "pppcom4", 4, 0,
- "pppcom5", 5, 0,
- "pppcom6", 6, 0,
- "pppcom7", 7, 0,
- "pppcom8", 8, 0
- #endif /* OS2ONLY */
- };
- int nos2dev = (sizeof(os2devtab) / sizeof(struct keytab));
- #ifdef OS2ONLY
- struct keytab os2ppptab[] = {
- "0", 0, CM_INV,
- "1", 1, CM_INV, /* Invisible synonyms, like */
- "2", 2, CM_INV, /* "set port 1" */
- "3", 3, CM_INV,
- "4", 4, CM_INV,
- "5", 5, CM_INV,
- "6", 6, CM_INV,
- "7", 7, CM_INV,
- "8", 8, CM_INV,
- "9", 9, CM_INV,
- "ppp0", 0, 0,
- "ppp1", 1, 0, /* For use with PPP driver */
- "ppp2", 2, 0, /* shared access */
- "ppp3", 3, 0,
- "ppp4", 4, 0,
- "ppp5", 5, 0,
- "ppp6", 6, 0,
- "ppp7", 7, 0,
- "ppp8", 8, 0,
- "ppp9", 9, 0
- };
- int nos2ppp = (sizeof(os2ppptab) / sizeof(struct keytab));
- #endif /* OS2ONLY */
- /*
- Terminal parameters that can be set by SET commands.
- Used by the ck?con.c terminal emulator code.
- For now, only used for #ifdef OS2. Should add these for Macintosh.
- */
- int tt_arrow = TTK_NORM; /* Arrow key mode: normal (cursor) */
- int tt_keypad = TTK_NORM; /* Keypad mode: normal (numeric) */
- int tt_shift_keypad = 0; /* Keypad Shift mode: Off */
- int tt_wrap = 1; /* Terminal wrap, 1 = On */
- int tt_type = TT_VT320; /* Terminal type, initially VT320 */
- int tt_type_mode = TT_VT320; /* Terminal type set by host command */
- int tt_cursor = 0; /* Terminal cursor, 0 = Underline */
- int tt_cursor_usr = 0; /* Users Terminal cursor type */
- int tt_cursorena_usr = 1; /* Users Terminal cursor enabled */
- int tt_answer = 0; /* Terminal answerback (disabled) */
- int tt_scrsize[VNUM] = {512,512,512,1}; /* Terminal scrollback buffer size */
- int tt_roll[VNUM] = {1,1,1,1}; /* Terminal roll (on) */
- int tt_pacing = 0; /* Terminal output-pacing (none) */
- int tt_inpacing = 0; /* Terminal input-pacing (none) */
- int tt_ctstmo = 15; /* Terminal transmit-timeout */
- int tt_codepage = -1; /* Terminal code-page */
- int tt_update = 100; /* Terminal screen-update interval */
- int tt_updmode = TTU_FAST; /* Terminal screen-update mode FAST */
- extern int updmode;
- int tt_font = TTF_ROM; /* Terminal screen font */
- #ifndef KUI
- int tt_status = 1; /* Terminal status line displayed */
- int tt_status_usr = 1;
- #else /* KUI */
- #ifdef K95G
- int tt_status = 1; /* Terminal status line displayed */
- int tt_status_usr = 1;
- #else /* K95G */
- int tt_status = 0; /* Terminal status line displayed */
- int tt_status_usr = 0;
- #endif /* K95G */
- #endif /* KUI */
- int tt_senddata = 0; /* Let host read terminal data */
- extern int wy_blockend; /* Terminal Send Data EOB type */
- int tt_hidattr = 1; /* Attributes are hidden */
- int tt_idlesnd_tmo = 0; /* Idle Send Timeout, disabled */
- char * tt_idlesnd_str = NULL; /* Idle Send String, none */
- extern unsigned char colornormal, colorselect,
- colorunderline, colorstatus, colorhelp, colorborder,
- colorgraphic, colordebug, colorreverse;
- extern int trueblink, trueunderline, truereverse;
- extern int bgi, fgi;
- extern int scrninitialized[];
- struct keytab audibletab[] = { /* Terminal Bell Audible mode */
- "beep", XYB_BEEP, 0, /* Values ORd with bell mode */
- "system-sounds", XYB_SYS, 0
- };
- int naudibletab = sizeof(audibletab)/sizeof(struct keytab);
- struct keytab akmtab[] = { /* Arrow key mode */
- "application", TTK_APPL, 0,
- "cursor", TTK_NORM, 0
- };
- struct keytab kpmtab[] = { /* Keypad mode */
- "application", TTK_APPL, 0,
- "numeric", TTK_NORM, 0
- };
- struct keytab ttcolmodetab[] = {
- "current-color", 0, 0,
- "default-color", 1, 0
- };
- int ncolmode = sizeof(ttcolmodetab)/sizeof(struct keytab);
- #define TTCOLNOR 0
- #define TTCOLREV 1
- #define TTCOLUND 2
- #define TTCOLSTA 3
- #define TTCOLHLP 4
- #define TTCOLBOR 5
- #define TTCOLSEL 6
- #define TTCOLDEB 7
- #define TTCOLGRP 8
- #define TTCOLRES 10
- #define TTCOLERA 11
- struct keytab ttycoltab[] = { /* Terminal Screen coloring */
- "border", TTCOLBOR, 0, /* Screen border color */
- "debug-terminal", TTCOLDEB, 0, /* Debug color */
- "erase", TTCOLERA, 0, /* Erase mode */
- "graphic", TTCOLGRP, 0, /* Graphic Color */
- "help-text", TTCOLHLP, 0, /* Help screens */
- "normal", TTCOLNOR, CM_INV, /* Normal screen text */
- "reset-on-esc[0m", TTCOLRES, 0, /* Reset on ESC [ 0 m */
- "reverse-video", TTCOLREV, 0, /* Reverse video */
- "status-line", TTCOLSTA, 0, /* Status line */
- "selection", TTCOLSEL, 0, /* Selection color */
- "terminal-screen", TTCOLNOR, 0, /* Better name than "normal" */
- "underlined-text", TTCOLUND, 0 /* Underlined text */
- };
- int ncolors = (sizeof(ttycoltab) / sizeof(struct keytab));
- #define TTATTNOR 0
- #define TTATTBLI 1
- #define TTATTREV 2
- #define TTATTUND 3
- #define TTATTPRO 4
- #define TTATTBLD 5
- #define TTATTDIM 6
- #define TTATTINV 7
- #define TTATTDONE 8
- struct keytab ttyattrtab[] = {
- "blink", TTATTBLI, 0,
- "protected",TTATTPRO, 0,
- "reverse", TTATTREV, 0,
- "underline",TTATTUND, 0
- };
- int nattrib = (sizeof(ttyattrtab) / sizeof(struct keytab));
- struct keytab ttyprotab[] = {
- "bold", TTATTBLD, 0,
- "dim", TTATTDIM, 0,
- "done", TTATTDONE, CM_INV,
- "invisible", TTATTINV, 0,
- "normal", TTATTNOR, 0,
- "reverse", TTATTREV, 0,
- "underlined", TTATTUND, 0
- };
- int nprotect = (sizeof(ttyprotab) / sizeof(struct keytab));
- struct keytab ttyseobtab[] = {
- "crlf_etx", 1, 0,
- "us_cr", 0, 0
- };
- struct keytab ttyclrtab[] = { /* Colors */
- "black", 0, 0,
- "blue", 1, 0,
- "brown", 6, 0,
- "cyan", 3, 0,
- "darkgray", 8, CM_INV,
- "dgray", 8, 0,
- "green", 2, 0,
- "lblue", 9, CM_INV,
- "lcyan", 11, CM_INV,
- "lgray", 7, CM_INV,
- "lgreen", 10, CM_INV,
- "lightblue", 9, 0,
- "lightcyan", 11, 0,
- "lightgray", 7, 0,
- "lightgreen", 10, 0,
- "lightmagenta",13,0,
- "lightred", 12, 0,
- "lmagenta", 13, CM_INV,
- "lred", 12, CM_INV,
- "magenta", 5, 0,
- "red", 4, 0,
- "white", 15, 0,
- "yellow", 14, 0
- };
- int nclrs = (sizeof (ttyclrtab) / sizeof (struct keytab));
- struct keytab ttycurtab[] = {
- "full", TTC_BLOCK, 0,
- "half", TTC_HALF, 0,
- "underline", TTC_ULINE, 0
- };
- int ncursors = 3;
- struct keytab ttyptab[] = {
- "aixterm", TT_AIXTERM, 0, /* IBM AIXterm */
- "ansi-bbs", TT_ANSI, 0, /* ANSI.SYS (BBS) */
- "at386", TT_AT386, 0, /* Unixware ANSI */
- "avatar/0+",TT_ANSI, 0, /* AVATAR/0+ */
- "ba80", TT_BA80, 0, /* Nixdorf BA80 */
- "be", TT_BEOS, CM_INV|CM_ABR,
- "beos-ansi",TT_BEOS, CM_INV, /* BeOS ANSI */
- "beterm", TT_BEOS, 0, /* BeOS Terminal (as of PR2 ) */
- "d200", TT_DG200, CM_INV|CM_ABR, /* Data General DASHER 200 */
- "d210", TT_DG210, CM_INV|CM_ABR, /* Data General DASHER 210 */
- "d217", TT_DG217, CM_INV|CM_ABR, /* Data General DASHER 217 */
- "dg200", TT_DG200, 0, /* Data General DASHER 200 */
- "dg210", TT_DG210, 0, /* Data General DASHER 210 */
- "dg217", TT_DG217, 0, /* Data General DASHER 217 */
- "h1500", TT_HZL1500, CM_INV, /* Hazeltine 1500 */
- "h19", TT_H19, CM_INV, /* Heath-19 */
- "heath19", TT_H19, 0, /* Heath-19 */
- "hft", TT_HFT, 0, /* IBM High Function Terminal */
- "hp2621a", TT_HP2621, 0, /* HP 2621A */
- "hpterm", TT_HPTERM, 0, /* HP TERM */
- "hz1500", TT_HZL1500, 0, /* Hazeltine 1500 */
- "ibm3151", TT_IBM31, CM_INV, /* IBM 3101-xx,3161 */
- "linux", TT_LINUX, 0, /* Linux */
- "qansi", TT_QANSI, 0, /* QNX ANSI */
- "qnx", TT_QNX, 0, /* QNX Console */
- "scoansi", TT_SCOANSI, 0, /* SCO ANSI */
- "sni-97801",TT_97801, 0, /* SNI 97801 */
- /*
- The idea of NONE is to let the console driver handle the escape sequences,
- which, in theory at least, would give not only ANSI emulation, but also any
- other kind of emulation that might be provided by alternative console
- drivers, if any existed.
- For this to work, ckocon.c would need to be modified to make higher-level
- calls, like VioWrtTTY(), DosWrite(), or (simply) write(), rather than
- VioWrt*Cell() and similar, and it would also have to give up its rollback
- feature, and its status line and help screens would also have to be
- forgotten or else done in an ANSI way.
- As matters stand, we already have perfectly good ANSI emulation built in,
- and there are no alternative console drivers available, so there is no point
- in having a terminal type of NONE, so it is commented out. However, should
- you uncomment it, it will work like a "glass tty" -- no escape sequence
- interpretation at all; somewhat similar to debug mode, except without the
- debugging (no highlighting of control chars or escape sequences); help
- screens, status line, and rollback will still work.
- */
- #ifdef OS2PM
- #ifdef COMMENT
- "tek4014", TT_TEK40, 0,
- #endif /* COMMENT */
- #endif /* OS2PM */
- "tty", TT_NONE, 0,
- "tvi910+", TT_TVI910, 0,
- "tvi925", TT_TVI925, 0,
- "tvi950", TT_TVI950, 0,
- "vc404", TT_VC4404, 0,
- "vc4404", TT_VC4404, CM_INV,
- "vip7809", TT_VIP7809, 0,
- "vt100", TT_VT100, 0,
- "vt102", TT_VT102, 0,
- "vt220", TT_VT220, 0,
- "vt220pc", TT_VT220PC, 0,
- "vt320", TT_VT320, 0,
- "vt320pc", TT_VT320PC, 0,
- "vt52", TT_VT52, 0,
- #ifdef NT
- "vtnt", TT_VTNT, 0,
- #else /* NT */
- "vtnt", TT_VTNT, CM_INV,
- #endif /* NT */
- "wy160", TT_WY160, 0,
- "wy30", TT_WY30, 0,
- "wy370", TT_WY370, 0,
- "wy50", TT_WY50, 0,
- "wy60", TT_WY60, 0,
- "wyse30", TT_WY30, CM_INV,
- "wyse370", TT_WY370, CM_INV,
- "wyse50", TT_WY50, CM_INV,
- "wyse60", TT_WY60, CM_INV
- };
- int nttyp = (sizeof(ttyptab) / sizeof(struct keytab));
- struct keytab ttkeytab[] = {
- "aixterm", TT_AIXTERM, 0, /* IBM AIXterm */
- "ansi-bbs", TT_ANSI, 0, /* ANSI.SYS (BBS) */
- "at386", TT_AT386, 0, /* Unixware ANSI */
- "avatar/0+", TT_ANSI, 0, /* AVATAR/0+ */
- "ba80", TT_BA80, 0, /* Nixdorf BA80 */
- "be", TT_BEOS, CM_INV|CM_ABR,
- "beos-ansi", TT_BEOS, CM_INV, /* BeOS ANSI */
- "beterm", TT_BEOS, 0, /* BeOS Terminal (as of PR2) */
- "d200", TT_DG200, CM_INV|CM_ABR, /* Data General DASHER 200 */
- "d210", TT_DG210, CM_INV|CM_ABR, /* Data General DASHER 210 */
- "d217", TT_DG217, CM_INV|CM_ABR, /* Data General DASHER 217 */
- "dg200", TT_DG200, 0, /* Data General DASHER 200 */
- "dg210", TT_DG210, 0, /* Data General DASHER 210 */
- "dg217", TT_DG217, 0, /* Data General DASHER 217 */
- "emacs", TT_KBM_EMACS, 0, /* Emacs mode */
- "h19", TT_H19, CM_INV, /* Heath-19 */
- "heath19", TT_H19, 0, /* Heath-19 */
- "hebrew", TT_KBM_HEBREW, 0, /* Hebrew mode */
- "hft", TT_HFT, 0, /* IBM High Function Terminal */
- "hp2621a", TT_HP2621, 0, /* HP 2621A */
- "hpterm", TT_HPTERM, 0, /* HP TERM */
- "hz1500", TT_HZL1500, 0, /* Hazeltine 1500 */
- "ibm3151", TT_IBM31, CM_INV, /* IBM 3101-xx,3161 */
- "linux", TT_LINUX, 0, /* Linux */
- "qansi", TT_QANSI, 0, /* QNX ANSI */
- "qnx", TT_QNX, 0, /* QNX */
- "russian", TT_KBM_RUSSIAN, 0, /* Russian mode */
- "scoansi", TT_SCOANSI, 0, /* SCO ANSI */
- "sni-97801", TT_97801, 0, /* SNI 97801 */
- #ifdef OS2PM
- #ifdef COMMENT
- "tek4014", TT_TEK40, 0,
- #endif /* COMMENT */
- #endif /* OS2PM */
- "tty", TT_NONE, 0,
- "tvi910+", TT_TVI910, 0,
- "tvi925", TT_TVI925, 0,
- "tvi950", TT_TVI950, 0,
- "vc404", TT_VC4404, 0,
- "vc4404", TT_VC4404, CM_INV,
- "vip7809", TT_VIP7809, 0,
- "vt100", TT_VT100, 0,
- "vt102", TT_VT102, 0,
- "vt220", TT_VT220, 0,
- "vt220pc", TT_VT220PC, 0,
- "vt320", TT_VT320, 0,
- "vt320pc", TT_VT320PC, 0,
- "vt52", TT_VT52, 0,
- "vtnt", TT_VTNT, CM_INV,
- "wp", TT_KBM_WP, 0, /* Word Perfect mode */
- "wy160", TT_WY160, 0,
- "wy30", TT_WY30, 0,
- "wy370", TT_WY370, 0,
- "wy50", TT_WY50, 0,
- "wy60", TT_WY60, 0,
- "wyse30", TT_WY30, CM_INV,
- "wyse370", TT_WY370, CM_INV,
- "wyse50", TT_WY50, CM_INV,
- "wyse60", TT_WY60, CM_INV
- };
- int nttkey = (sizeof(ttkeytab) / sizeof(struct keytab));
- struct keytab kbmodtab[] = {
- "normal", KBM_EN, 0,
- "none", KBM_EN, CM_INV,
- "emacs", KBM_EM, 0,
- "english", KBM_EN, CM_INV,
- "hebrew", KBM_HE, 0,
- "russian", KBM_RU, 0,
- "wp", KBM_WP, 0
- };
- int nkbmodtab = (sizeof(kbmodtab) / sizeof(struct keytab));
- struct keytab prtytab[] = { /* OS/2 Priority Levels */
- "foreground-server", XYP_SRV, 0,
- "idle", XYP_IDLE, CM_INV,
- "regular", XYP_REG, 0,
- "time-critical", XYP_RTP, 0
- };
- int nprty = (sizeof(prtytab) / sizeof(struct keytab));
- #endif /* OS2 */
- #ifdef NT
- struct keytab win95tab[] = { /* Win95 work-arounds */
- "8.3-filenames", XYW8_3, 0,
- "alt-gr", XYWAGR, 0,
- "keyboard-translation", XYWKEY, 0,
- "lucida-substitutions", XYWLUC, 0,
- "overlapped-io", XYWOIO, 0,
- "popups", XYWPOPUP, 0,
- "select-bug", XYWSELECT, 0
- };
- int nwin95 = (sizeof(win95tab) / sizeof(struct keytab));
- #endif /* NT */
- #ifdef OS2MOUSE
- extern int wideresult;
- int tt_mouse = 1; /* Terminal mouse on/off */
- struct keytab mousetab[] = { /* Mouse items */
- "activate", XYM_ON, 0,
- "button", XYM_BUTTON, 0,
- "clear", XYM_CLEAR, 0
- };
- int nmtab = (sizeof(mousetab)/sizeof(struct keytab));
- struct keytab mousebuttontab[] = { /* event button */
- "one", XYM_B1, CM_INV,
- "three", XYM_B3, CM_INV,
- "two", XYM_B2, CM_INV,
- "1", XYM_B1, 0,
- "2", XYM_B2, 0,
- "3", XYM_B3, 0
- };
- int nmbtab = (sizeof(mousebuttontab) / sizeof(struct keytab));
- struct keytab mousemodtab[] = { /* event button key modifier */
- "alt", XYM_ALT, 0,
- "alt-shift", XYM_SHIFT|XYM_ALT, 0,
- "ctrl", XYM_CTRL, 0,
- "ctrl-alt", XYM_CTRL|XYM_ALT, 0,
- "ctrl-alt-shift", XYM_CTRL|XYM_SHIFT|XYM_ALT, 0,
- "ctrl-shift", XYM_CTRL|XYM_SHIFT, 0,
- "none", 0, 0,
- "shift", XYM_SHIFT, 0
- };
- int nmmtab = (sizeof(mousemodtab) / sizeof(struct keytab));
- struct keytab mclicktab[] = { /* event button click modifier */
- "click", XYM_C1, 0,
- "drag", XYM_DRAG, 0,
- "double-click", XYM_C2, 0
- };
- int nmctab = (sizeof(mclicktab) / sizeof(struct keytab));
- #ifndef NOKVERBS
- extern int nkverbs;
- extern struct keytab kverbs[];
- #endif /* NOKVERBS */
- #endif /* OS2MOUSE */
- /* #ifdef VMS */
- struct keytab fbtab[] = { /* Binary record types for VMS */
- "fixed", XYFT_B, 0, /* Fixed is normal for binary */
- "undefined", XYFT_U, 0 /* Undefined if they ask for it */
- };
- int nfbtyp = (sizeof(fbtab) / sizeof(struct keytab));
- /* #endif */
- #ifdef VMS
- struct keytab lbltab[] = { /* Labeled File info */
- "acl", LBL_ACL, 0,
- "backup-date", LBL_BCK, 0,
- "name", LBL_NAM, 0,
- "owner", LBL_OWN, 0,
- "path", LBL_PTH, 0
- };
- int nlblp = (sizeof(lbltab) / sizeof(struct keytab));
- #else
- #ifdef OS2
- struct keytab lbltab[] = { /* Labeled File info */
- "archive", LBL_ARC, 0,
- "extended", LBL_EXT, 0,
- "hidden", LBL_HID, 0,
- "read-only", LBL_RO, 0,
- "system", LBL_SYS, 0
- };
- int nlblp = (sizeof(lbltab) / sizeof(struct keytab));
- #endif /* OS2 */
- #endif /* VMS */
- #ifdef CK_CURSES
- #ifdef CK_PCT_BAR
- static struct keytab fdftab[] = { /* SET FILE DISPLAY FULL options */
- "thermometer", 1, 0,
- "no-thermometer", 0, 0
- };
- extern int thermometer;
- #endif /* CK_PCT_BAR */
- #endif /* CK_CURSES */
- static struct keytab fdtab[] = { /* SET FILE DISPLAY options */
- #ifdef MAC /* Macintosh */
- "fullscreen", XYFD_R, 0, /* Full-screen but not curses */
- "none", XYFD_N, 0,
- "off", XYFD_N, CM_INV,
- "on", XYFD_R, CM_INV,
- "quiet", XYFD_N, CM_INV
- #else /* Not Mac */
- "brief", XYFD_B, 0, /* Brief */
- "crt", XYFD_S, 0, /* CRT display */
- #ifdef CK_CURSES
- #ifdef COMMENT
- "curses", XYFD_C, CM_INV, /* Full-screen, curses */
- #endif /* COMMENT */
- "fullscreen", XYFD_C, 0, /* Full-screen, whatever the method */
- #endif /* CK_CURSES */
- "none", XYFD_N, 0, /* No display */
- "off", XYFD_N, CM_INV, /* Ditto */
- "on", XYFD_R, CM_INV, /* On = Serial */
- "quiet", XYFD_N, CM_INV, /* No display */
- "serial", XYFD_R, 0 /* Serial */
- #endif /* MAC */
- };
- int nfdtab = (sizeof(fdtab) / sizeof(struct keytab));
- struct keytab rsrtab[] = { /* For REMOTE SET RECEIVE */
- "packet-length", XYLEN, 0,
- "timeout", XYTIMO, 0
- };
- int nrsrtab = (sizeof(rsrtab) / sizeof(struct keytab));
- /* Send/Receive Parameters */
- struct keytab srtab[] = {
- "backup", XYBUP, 0,
- #ifndef NOCSETS
- "character-set-selection", XYCSET, 0,
- #endif /* NOCSETS */
- "control-prefix", XYQCTL, 0,
- #ifdef CKXXCHAR
- "double-character", XYDBL, 0,
- #endif /* CKXXCHAR */
- "end-of-packet", XYEOL, 0,
- #ifdef PIPESEND
- "filter", XYFLTR, 0,
- #endif /* PIPESEND */
- #ifdef CKXXCHAR
- "ignore-character", XYIGN, 0,
- #endif /* CKXXCHAR */
- "move-to", XYMOVE, 0,
- "negotiation-string-max-length", XYINIL, CM_INV,
- "packet-length", XYLEN, 0,
- "pad-character", XYPADC, 0,
- "padding", XYNPAD, 0,
- "pathnames", XYFPATH, 0,
- "pause", XYPAUS, 0,
- "quote", XYQCTL, CM_INV, /* = CONTROL-PREFIX */
- "rename-to", XYRENAME, 0,
- "start-of-packet", XYMARK, 0,
- "timeout", XYTIMO, 0,
- #ifdef VMS
- "version-numbers", 887, 0, /* VMS version numbers */
- #endif /* VMS */
- "", 0, 0
- };
- int nsrtab = (sizeof(srtab) / sizeof(struct keytab)) - 1;
- #ifdef UNICODE
- #define UCS_BOM 1
- #define UCS_BYT 2
- static struct keytab ucstab[] = {
- "bom", UCS_BOM, 0,
- "byte-order", UCS_BYT, 0,
- "", 0, 0
- };
- int nucstab = (sizeof(ucstab) / sizeof(struct keytab)) - 1;
- static struct keytab botab[] = {
- "big-endian", 0, 0,
- "little-endian", 1, 0
- };
- static int nbotab = 2;
- #endif /* UNICODE */
- /* REMOTE SET */
- struct keytab rmstab[] = {
- "attributes", XYATTR, 0,
- "block-check", XYCHKT, 0,
- "file", XYFILE, 0,
- "incomplete", XYIFD, CM_INV, /* REMOTE SET FILE INCOMPLETE preferred */
- "receive", XYRECV, 0,
- "retry", XYRETR, 0,
- "server", XYSERV, 0,
- "transfer", XYXFER, 0,
- "window", XYWIND, 0,
- "xfer", XYXFER, CM_INV
- };
- int nrms = (sizeof(rmstab) / sizeof(struct keytab));
- struct keytab attrtab[] = {
- #ifdef STRATUS
- "account", AT_ACCT, 0,
- #endif /* STRATUS */
- "all", AT_XALL, 0,
- #ifdef COMMENT
- "blocksize", AT_BLKS, 0, /* (not used) */
- #endif /* COMMENT */
- #ifndef NOCSETS
- "character-set", AT_ENCO, 0,
- #endif /* NOCSETS */
- #ifdef STRATUS
- "creator", AT_CREA, 0,
- #endif /* STRATUS */
- "date", AT_DATE, 0,
- "disposition", AT_DISP, 0,
- "encoding", AT_ENCO, CM_INV,
- #ifdef STRATUS
- "format", AT_RECF, 0,
- #endif /* STRATUS */
- "length", AT_LENK, 0,
- "off", AT_ALLN, 0,
- "on", AT_ALLY, 0,
- #ifdef COMMENT
- "os-specific", AT_SYSP, 0, /* (not used by UNIX or VMS) */
- #endif /* COMMENT */
- #ifdef CK_PERMS
- "protection", AT_LPRO, 0,
- "permissions", AT_LPRO, CM_INV,
- #endif /* CK_PERMS */
- "system-id", AT_SYSI, 0,
- "type", AT_FTYP, 0
- };
- int natr = (sizeof(attrtab) / sizeof(struct keytab)); /* how many attributes */
- #ifndef NOSPL
- extern int indef, inecho, insilence, inbufsize, inautodl, inintr;
- extern char * inpbuf, * inpbp;
- #ifdef OS2
- extern int interm;
- #endif /* OS2 */
- struct keytab inptab[] = { /* SET INPUT parameters */
- #ifdef CK_AUTODL
- "autodownload", IN_ADL, 0,
- #endif /* CK_AUTODL */
- "buffer-length", IN_BUF, 0,
- "cancellation", IN_CAN, 0,
- "case", IN_CAS, 0,
- "default-timeout", IN_DEF, CM_INV, /* There is no default timeout */
- "echo", IN_ECH, 0,
- #ifdef OS2
- "pacing", IN_PAC, CM_INV,
- #endif /* OS2 */
- "silence", IN_SIL, 0,
- #ifdef OS2
- "terminal", IN_TRM, 0,
- #endif /* OS2 */
- "timeout-action", IN_TIM, 0
- };
- int ninp = (sizeof(inptab) / sizeof(struct keytab));
- struct keytab intimt[] = { /* SET INPUT TIMEOUT parameters */
- "proceed", 0, 0, /* 0 = proceed */
- "quit", 1, 0 /* 1 = quit */
- };
- struct keytab incast[] = { /* SET INPUT CASE parameters */
- "ignore", 0, 0, /* 0 = ignore */
- "observe", 1, 0 /* 1 = observe */
- };
- #endif /* NOSPL */
- struct keytab nabltab[] = { /* For any command that needs */
- "disabled", 0, 0,
- "enabled", 1, 0,
- "off", 0, CM_INV, /* these keywords... */
- "on", 1, CM_INV
- };
- int nnabltab = sizeof(nabltab) / sizeof(struct keytab);
- #ifdef OS2
- struct keytab tvctab[] = { /* SET TERM VIDEO-CHANGE */
- "disabled", TVC_DIS, 0,
- "enabled", TVC_ENA, 0
- #ifdef NT
- ,"win95-safe", TVC_W95, 0
- #endif /* NT */
- };
- int ntvctab = sizeof(tvctab) / sizeof(struct keytab);
- struct keytab msktab[] = { /* SET MS-DOS KERMIT compatibilities */
- #ifdef COMMENT
- "color", MSK_COLOR, 0,
- #endif /* COMMENT */
- "keycodes", MSK_KEYS, 0
- };
- int nmsk = (sizeof(msktab) / sizeof(struct keytab));
- struct keytab scrnupd[] = { /* SET TERMINAL SCREEN-UPDATE */
- "fast", TTU_FAST, 0,
- "smooth", TTU_SMOOTH, 0
- };
- int nscrnupd = (sizeof(scrnupd) / sizeof(struct keytab));
- struct keytab termfont[] = { /* SET TERMINAL FONT */
- #ifdef COMMENT
- "cp111", TTF_111, 0,
- "cp112", TTF_112, 0,
- "cp113", TTF_113, 0,
- #endif /* COMMENT */
- "cp437", TTF_437, 0,
- "cp850", TTF_850, 0,
- #ifdef COMMENT
- "cp851", TTF_851, 0,
- #endif /* COMMENT */
- "cp852", TTF_852, 0,
- #ifdef COMMENT
- "cp853", TTF_853, 0,
- "cp860", TTF_860, 0,
- "cp861", TTF_861, 0,
- #endif /* COMMENT */
- "cp862", TTF_862, 0,
- #ifdef COMMENT
- "cp863", TTF_863, 0,
- "cp864", TTF_864, 0,
- "cp865", TTF_865, 0,
- #endif /* COMMENT */
- "cp866", TTF_866, 0,
- #ifdef COMMENT
- "cp880", TTF_880, 0,
- "cp881", TTF_881, 0,
- "cp882", TTF_882, 0,
- "cp883", TTF_883, 0,
- "cp884", TTF_884, 0,
- "cp885", TTF_885, 0,
- #endif /* COMMENT */
- "default", TTF_ROM, 0
- };
- int ntermfont = (sizeof(termfont) / sizeof(struct keytab));
- struct keytab anbktab[] = { /* For any command that needs */
- "message", 2, 0, /* these keywords... */
- "off", 0, 0,
- "on", 1, 0,
- "unsafe-messag0", 99, CM_INV,
- "unsafe-message", 3, CM_INV
- };
- int nansbk = (sizeof(anbktab) / sizeof(struct keytab));
- int win95_popup = 1;
- #ifdef NT
- int win95altgr = 0;
- #ifdef KUI
- int win95lucida = 0;
- #else /* KUI */
- int win95lucida = 1;
- #endif /* KUI */
- extern int win95selectbug;
- extern int win95_8_3;
- #ifdef COMMENT
- extern CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR);
- extern struct keytab tcstab[];
- extern int ntcs;
- #endif /* COMMENT */
- extern int maxow, maxow_usr; owwait; /* Overlapped I/O variables */
- #endif /* NT */
- #endif /* OS2 */
- /* The following routines broken out of doprm() to give compilers a break. */
- /* S E T O N -- Parse on/off (default on), set parameter to result */
- int
- seton(prm) int *prm; {
- int x, y;
- if ((y = cmkey(onoff,2,"","on",xxstring)) < 0) return(y);
- if ((x = cmcfm()) < 0) return(x);
- *prm = y;
- return(1);
- }
- /* S E T O N A U T O -- Parse on/off/auto (default auto) & set result */
- struct keytab onoffaut[] = {
- "auto", SET_AUTO, 0, /* 2 */
- "off", SET_OFF, 0, /* 0 */
- "on", SET_ON, 0 /* 1 */
- };
- int
- setonaut(prm) int *prm; {
- int x, y;
- if ((y = cmkey(onoffaut,3,"","auto",xxstring)) < 0) return(y);
- if ((x = cmcfm()) < 0) return(x);
- *prm = y;
- return(1);
- }
- /* S E T N U M -- Set parameter to result of cmnum() parse. */
- /*
- Call with pointer to integer variable to be set,
- x = number from cnum parse, y = return code from cmnum,
- max = maximum value to accept, -1 if no maximum.
- Returns -9 on failure, after printing a message, or 1 on success.
- */
- int
- setnum(prm,x,y,max) int x, y, *prm, max; {
- debug(F101,"setnum","",y);
- if (y == -3) {
- printf("n?Value requiredn");
- return(-9);
- }
- if (y == -2) {
- printf("%s?Not a number: %sn",cmflgs == 1 ? "" : "n", atxbuf);
- return(-9);
- }
- if (y < 0) return(y);
- if (max > -1 && x > max) {
- printf("?Sorry, %d is the maximumn",max);
- return(-9);
- }
- if ((y = cmcfm()) < 0) return(y);
- *prm = x;
- return(1);
- }
- /* S E T C C -- Set parameter var to an ASCII control character value. */
- /*
- Parses a number, or a literal control character, or a caret (^) followed
- by an ASCII character whose value is 63-95 or 97-122, then gets confirmation,
- then sets the parameter to the code value of the character given. If there
- are any parse errors, they are returned, otherwise on success 1 is returned.
- */
- int
- setcc(dflt,var) char *dflt; int *var; {
- int x, y;
- unsigned int c;
- char *hlpmsg = "Control character,n
- numeric ASCII value,n
- or in ^X notation,n
- or preceded by a backslash and entered literally";
- /* This is a hack to turn off complaints from expression evaluator. */
- x_ifnum = 1;
- y = cmnum(hlpmsg, dflt, 10, &x, xxstring); /* Parse a number */
- x_ifnum = 0; /* Allow complaints again */
- if (y < 0) { /* Parse failed */
- if (y != -2) /* Reparse needed or somesuch */
- return(y); /* Pass failure back up the chain */
- }
- /* Did they type a real control character? */
- for (c = strlen(atmbuf) - 1; c > 0; c--) /* Trim */
- if (atmbuf[c] == SP) atmbuf[c] = NUL;
- if (y < 0) { /* It was not a number */
- if ((c = atmbuf[0]) && !atmbuf[1]) { /* Was it a literal Ctrl char? */
- if ((c > 037) && (c != 0177)) {
- printf("n?Not a control character - %dn",c);
- return(-9);
- } else {
- if ((y = cmcfm()) < 0) /* Confirm */
- return(y);
- *var = c; /* Set the variable */
- return(1);
- }
- } else if (atmbuf[0] == '^' && !atmbuf[2]) { /* Or ^X notation? */
- c = atmbuf[1];
- if (islower((char) c)) /* Uppercase lowercase letters */
- c = toupper(c);
- if (c > 62 && c < 96) { /* Check range */
- if ((y = cmcfm()) < 0)
- return(y);
- *var = ctl(c); /* OK */
- return(1);
- } else {
- printf("?Not a control character - %sn", atmbuf);
- return(-9);
- }
- } else { /* Something illegal was typed */
- printf("?Invalid - %sn", atmbuf);
- return(-9);
- }
- }
- if ((x > 037) && (x != 0177)) { /* They typed a number */
- printf("n?Not in ASCII control range - %dn",x);
- return(-9);
- }
- if ((y = cmcfm()) < 0) /* In range, confirm */
- return(y);
- *var = x; /* Set variable */
- return(1);
- }
- #ifndef NOSPL /* The SORT command... */
- static struct keytab srtswtab[] = { /* SORT command switches */
- "/case", SRT_CAS, CM_ARG,
- "/key", SRT_KEY, CM_ARG,
- "/numeric", SRT_NUM, 0,
- "/range", SRT_RNG, CM_ARG,
- "/reverse", SRT_REV, 0
- };
- static int nsrtswtab = sizeof(srtswtab)/sizeof(struct keytab);
- extern char **a_ptr[]; /* Array pointers */
- extern int a_dim[]; /* Array dimensions */
- int
- dosort() { /* Do the SORT command */
- char c, *p = NULL, ** ap, ** xp = NULL;
- struct FDB sw, fl, cm;
- int hi, lo;
- int xn = 0, xr = -1, xk = -1, xc = -1, xs = 0;
- int getval = 0, range[2], confirmed = 0;
- cmfdbi(&sw, /* First FDB - command switches */
- _CMKEY, /* fcode */
- "Array name or switch",
- "", /* default */
- "", /* addtl string data */
- nsrtswtab, /* addtl numeric data 1: tbl size */
- 4, /* addtl numeric data 2: 4 = cmswi */
- NULL, /* Processing function */
- srtswtab, /* Keyword table */
- &fl /* Pointer to next FDB */
- );
- cmfdbi(&fl, /* Anything that doesn't match */
- _CMFLD, /* fcode */
- "Array name", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- NULL,
- NULL,
- &cm
- );
- cmfdbi(&cm, /* Or premature confirmation */
- _CMCFM, /* fcode */
- "", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- NULL,
- NULL,
- NULL
- );
- range[0] = -1;
- range[1] = -1;
- while (1) { /* Parse 0 or more switches */
- x = cmfdb(&sw);
- if (x < 0)
- return(x);
- if (cmresult.fcode != _CMKEY) /* Break out if not a switch */
- break;
- c = cmgbrk();
- getval = (c == ':' || c == '=');
- if (getval && !(cmresult.kflags & CM_ARG)) {
- printf("?This switch does not take argumentsn");
- return(-9);
- }
- switch (cmresult.nresult) {
- case SRT_REV:
- xr = 1;
- break;
- case SRT_KEY:
- if (getval) {
- if ((y = cmnum("Column for comparison (1-based)",
- "1",10,&x,xxstring)) < 0)
- return(y);
- xk = x - 1;
- } else
- xk = 0;
- break;
- case SRT_CAS:
- if (getval) {
- if ((y = cmkey(onoff,2,"","on",xxstring)) < 0)
- return(y);
- xc = y;
- } else
- xc = 1;
- break;
- case SRT_RNG: /* /RANGE */
- if (getval) {
- char buf[32];
- char buf2[16];
- int i;
- char * p, * q;
- if ((y = cmfld("low:high element","1",&s,NULL)) < 0)
- return(y);
- s = brstrip(s);
- ckstrncpy(buf,s,32);
- p = buf;
- for (i = 0; *p && i < 2; i++) { /* Get low and high */
- q = p; /* Start of this piece */
- while (*p) { /* Find end of this piece */
- if (*p == ':') {
- *p = NUL;
- p++;
- break;
- }
- p++;
- }
- y = 15; /* Evaluate this piece */
- s = buf2;
- zzstring(q,&s,&y);
- s = evalx(buf2);
- if (s) if (*s) ckstrncpy(buf2,s,16);
- if (!rdigits(buf2)) {
- printf("?Not numeric: %sn",buf2);
- return(-9);
- }
- range[i] = atoi(buf2);
- }
- }
- break;
- case SRT_NUM: /* /NUMERIC */
- xn = 1;
- break;
- default:
- return(-2);
- }
- }
- switch (cmresult.fcode) {
- case _CMCFM:
- confirmed = 1;
- break;
- case _CMFLD:
- ckstrncpy(line,cmresult.sresult,LINBUFSIZ); /* Safe copy of name */
- s = line;
- break;
- default:
- printf("?Unexpected function code: %dn",cmresult.fcode);
- return(-9);
- }
- if (confirmed) {
- printf("?Array name requiredn");
- return(-9);
- }
- sprintf(tmpbuf,"Second array to sort according to %s",s);
- debug(F101,"XXX 1","",0);
- if ((x = cmfld(tmpbuf,"",&p,NULL)) < 0)
- if (x != -3)
- return(x);
- debug(F101,"XXX 2","",0);
- tmpbuf[0] = NUL;
- strcpy(tmpbuf,p);
- p = tmpbuf;
- if ((x = cmcfm()) < 0) /* Get confirmation */
- return(x);
- debug(F101,"XXX 3","",0);
- x = arraybounds(s,&lo,&hi); /* Get array index & bounds */
- if (x < 0) { /* Check */
- printf("?Bad array name: %sn",s);
- return(-9);
- }
- if (lo > -1) range[0] = lo; /* Set range */
- if (hi > -1) range[1] = hi;
- ap = a_ptr[x]; /* Get pointer to array element list */
- if (!ap) { /* Check */
- printf("?Array not declared: %sn", s);
- return(-9);
- }
- if (range[0] < 0) /* Starting element */
- range[0] = 1;
- if (range[1] < 0) /* Final element */
- range[1] = a_dim[x];
- if (range[1] > a_dim[x]) {
- printf("?range %d:%d exceeds array dimension %dn",
- range[0],range[1],a_dim[x]
- );
- return(-9);
- }
- ap += range[0];
- xs = range[1] - range[0] + 1; /* Number of elements to sort */
- if (xs < 1) { /* Check */
- printf("?Bad range: %d:%dn",range[0],range[1]);
- return(-9);
- }
- if (xk < 0) xk = 0; /* Key position */
- if (xr < 0) xr = 0; /* Reverse flag */
- if (xn) /* Numeric flag */
- xc = 2;
- else if (xc < 0) /* Not numeric */
- xc = inpcas[cmdlvl]; /* so alpha case option */
- if (*p) { /* Parallel array given? */
- y = xarray(p); /* Yes, get its index. */
- if (y < 0) {
- printf("?Bad array name: %sn", p);
- return(-9);
- }
- if (y != x) { /* If the 2 arrays are different */
- xp = a_ptr[y]; /* Pointer to 2nd array element list */
- if (!xp) {
- printf("?Array not declared: %sn", p);
- return(-9);
- }
- if (a_dim[y] < range[1]) {
- printf("?Array %s smaller than %sn", p, s);
- return(-9);
- }
- xp += range[0]; /* Set base to same as 1st array */
- }
- }
- debug(F101,"XXX xp","",xp);
- debug(F101,"XXX xc","",xc);
- sh_sort(ap,xp,xs,xk,xr,xc); /* Sort the array(s) */
- return(success = 1); /* Always succeeds */
- }
- #endif /* NOSPL */
- static struct keytab purgtab[] = { /* PURGE command switches */
- "/after", PU_AFT, CM_ARG,
- "/ask", PU_ASK, 0,
- "/before", PU_BEF, CM_ARG,
- "/delete", PU_DELE, CM_INV,
- #ifdef UNIXOROSK
- "/dotfiles", PU_DOT, 0,
- #endif /* UNIXOROSK */
- "/except", PU_EXC, CM_ARG,
- "/heading", PU_HDG, 0,
- "/keep", PU_KEEP, CM_ARG,
- "/larger-than", PU_LAR, CM_ARG,
- "/list", PU_LIST, 0,
- "/log", PU_LIST, CM_INV,
- "/noask", PU_NASK, 0,
- "/nodelete", PU_NODE, CM_INV,
- #ifdef UNIXOROSK
- "/nodotfiles", PU_NODOT,0,
- #endif /* UNIXOROSK */
- "/noheading", PU_NOH, 0,
- "/nol", PU_NOLI, CM_INV|CM_ABR,
- "/nolist", PU_NOLI, 0,
- "/nolog", PU_NOLI, CM_INV,
- #ifdef CK_TTGWSIZ
- "/nopage", PU_NOPA, 0,
- #endif /* CK_TTGWSIZ */
- "/not-after", PU_NAF, CM_ARG,
- "/not-before", PU_NBF, CM_ARG,
- "/not-since", PU_NAF, CM_INV|CM_ARG,
- #ifdef CK_TTGWSIZ
- "/page", PU_PAGE, 0,
- #endif /* CK_TTGWSIZ */
- "/quiet", PU_QUIE, CM_INV,
- #ifdef RECURSIVE
- "/recursive", PU_RECU, 0,
- #endif /* RECURSIVE */
- "/since", PU_AFT, CM_ARG|CM_INV,
- "/simulate", PU_NODE, 0,
- "/smaller-than", PU_SMA, CM_ARG,
- "/verbose", PU_VERB, CM_INV
- };
- static int npurgtab = sizeof(purgtab)/sizeof(struct keytab);
- int
- bkupnum(s,i) char * s; int *i; {
- int k = 0, pos = 0;
- char * p = NULL, *q;
- *i = pos;
- if (!s) s = "";
- if (!*s)
- return(-1);
- if ((k = strlen(s)) < 5)
- return(-1);
- if (s[k-1] != '~')
- return(-1);
- pos = k - 2;
- q = s + pos;
- while (q >= s && isdigit(*q)) {
- p = q--;
- pos--;
- }
- if (!p)
- return(-1);
- if (q < s+2)
- return(-1);
- if (*q != '~' || *(q-1) != '.')
- return(-1);
- pos--;
- *i = pos;
- debug(F111,"bkupnum",s+pos,pos);
- return(atoi(p));
- }
- #ifdef CKPURGE
- /* Presently only for UNIX because we need direct access to the file array. */
- /* Not needed for VMS anyway, because we don't make backup files there. */
- #define MAXKEEP 32 /* Biggest /KEEP: value */
- static int
- pu_keep = 0, pu_list = 0, pu_dot = 0, pu_ask = 0, pu_hdg = 0;
- #ifdef CK_TTGWSIZ
- static int pu_page = -1;
- #else
- static int pu_page = 0;
- #endif /* CK_TTGWSIZ */
- #ifndef NOSHOW
- VOID
- showpurgopts() { /* SHOW PURGE command options */
- int x = 0;
- extern int optlines;
- prtopt(&optlines,"PURGE");
- if (pu_ask > -1) {
- x++;
- prtopt(&optlines, pu_ask ? "/ASK" : "/NOASK");
- }
- #ifdef UNIXOROSK
- if (pu_dot > -1) {
- x++;
- prtopt(&optlines, pu_dot ? "/DOTFILES" : "/NODOTFILES");
- }
- #endif /* UNIXOROSK */
- if (pu_keep > -1) {
- x++;
- sprintf(tmpbuf, "%s:%d", "/KEEP", pu_keep);
- prtopt(&optlines,tmpbuf);
- }
- if (pu_list > -1) {
- x++;
- prtopt(&optlines, pu_list ? "/LIST" : "/NOLIST");
- }
- if (pu_hdg > -1) {
- x++;
- prtopt(&optlines, pu_hdg ? "/HEADING" : "/NOHEADING");
- }
- #ifdef CK_TTGWSIZ
- if (pu_page > -1) {
- x++;
- prtopt(&optlines, pu_page ? "/PAGE" : "/NOPAGE");
- }
- #endif /* CK_TTGWSIZ */
- if (!x) prtopt(&optlines,"(no options set)");
- prtopt(&optlines,"");
- }
- #endif /* NOSHOW */
- int
- setpurgopts() { /* Set PURGE command options */
- int c, z, getval = 0;
- int
- x_keep = -1, x_list = -1, x_page = -1,
- x_hdg = -1, x_ask = -1, x_dot = -1;
- while (1) {
- if ((y = cmswi(purgtab,npurgtab,"Switch","",xxstring)) < 0) {
- if (y == -3)
- break;
- else
- return(y);
- }
- c = cmgbrk();
- if ((getval = (c == ':' || c == '=')) && !(cmgkwflgs() & CM_ARG)) {
- printf("?This switch does not take an argumentn");
- return(-9);
- }
- if (!getval && (cmgkwflgs() & CM_ARG)) {
- printf("?This switch requires an argumentn");
- return(-9);
- }
- switch (y) {
- case PU_KEEP:
- z = 1;
- if (c == ':' || c == '=')
- if ((y = cmnum("How many backup files to keep",
- "1",10,&z,xxstring)) < 0)
- return(y);
- if (z < 0 || z > MAXKEEP) {
- printf("?Please specify a number between 0 and %dn",
- MAXKEEP
- );
- return(-9);
- }
- x_keep = z;
- break;
- case PU_LIST:
- case PU_VERB:
- x_list = 1;
- break;
- case PU_QUIE:
- case PU_NOLI:
- x_list = 0;
- break;
- #ifdef CK_TTGWSIZ
- case PU_PAGE:
- x_page = 1;
- break;
- case PU_NOPA:
- x_page = 0;
- break;
- #endif /* CK_TTGWSIZ */
- case PU_HDG:
- x_hdg = 1;
- break;
- case PU_NOH:
- x_hdg = 0;
- break;
- case PU_ASK:
- x_ask = 1;
- break;
- case PU_NASK:
- x_ask = 0;
- break;
- #ifdef UNIXOROSK
- case PU_DOT:
- x_dot = 1;
- break;
- case PU_NODOT:
- x_dot = 0;
- break;
- #endif /* UNIXOROSK */
- default:
- printf("?This option can not be setn");
- return(-9);
- }
- }
- if ((x = cmcfm()) < 0) /* Get confirmation */
- return(x);
- if (x_keep > -1) /* Set PURGE defaults. */
- pu_keep = x_keep;
- if (x_list > -1)
- pu_list = x_list;
- #ifdef CK_TTGWSIZ
- if (x_page > -1)
- pu_page = x_page;
- #endif /* CK_TTGWSIZ */
- if (x_hdg > -1)
- pu_hdg = x_hdg;
- if (x_ask > -1)
- pu_ask = x_ask;
- if (x_dot > -1)
- pu_dot = x_dot;
- return(success = 1);
- }
- int
- dopurge() { /* Do the PURGE command */
- extern char ** mtchs;
- extern int xaskmore, cmd_rows, recursive;
- int simulate = 0, asking = 0;
- int listing = 0, paging = -1, lines = 0, deleting = 1, errors = 0;
- struct FDB sw, sf, cm;
- int g, i, j, k, m = 0, n, x, y, z, done = 0, count = 0, flags = 0;
- int tokeep = 0, getval = 0, havename = 0, confirmed = 0;
- int xx[MAXKEEP+1]; /* Array of numbers to keep */
- int min = -1;
- int x_hdg = 0, fs = 0, rc = 0;
- long minsize = -1L, maxsize = -1L;
- char namebuf[CKMAXPATH+4];
- char basebuf[CKMAXPATH+4];
- char
- * pu_aft = NULL,
- * pu_bef = NULL,
- * pu_naf = NULL,
- * pu_nbf = NULL,
- * pu_exc = NULL;
- char * pxlist[8]; /* Exception list */
- if (pu_keep > -1) /* Set PURGE defaults. */
- tokeep = pu_keep;
- if (pu_list > -1)
- listing = pu_list;
- #ifdef CK_TTGWSIZ
- if (pu_page > -1)
- paging = pu_page;
- #endif /* CK_TTGWSIZ */
- for (i = 0; i <= MAXKEEP; i++) /* Clear this number buffer */
- xx[i] = 0;
- for (i = 0; i < 8; i++) /* Initialize these... */
- pxlist[i] = NULL;
- g_matchdot = matchdot; /* Save these... */
- saveask = xaskmore;
- cmfdbi(&sw, /* 1st FDB - PURGE switches */
- _CMKEY, /* fcode */
- "Filename or switch", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- npurgtab, /* addtl numeric data 1: tbl size */
- 4, /* addtl numeric data 2: 4 = cmswi */
- xxstring, /* Processing function */
- purgtab, /* Keyword table */
- &sf /* Pointer to next FDB */
- );
- cmfdbi(&sf, /* 2nd FDB - filespec to purge */
- _CMIFI, /* fcode */
- "",
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- xxstring,
- NULL,
- &cm
- );
- cmfdbi(&cm, /* Or premature confirmation */
- _CMCFM, /* fcode */
- "", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- NULL,
- NULL,
- NULL
- );
- while (!havename && !confirmed) {
- x = cmfdb(&sw); /* Parse something */
- if (x < 0) { /* Error */
- rc = x;
- goto xpurge;
- } else if (cmresult.fcode == _CMKEY) {
- char c;
- c = cmgbrk();
- if ((getval = (c == ':' || c == '=')) && !(cmgkwflgs() & CM_ARG)) {
- printf("?This switch does not take an argumentn");
- rc = -9;
- goto xpurge;
- }
- if (!getval && (cmgkwflgs() & CM_ARG)) {
- printf("?This switch requires an argumentn");
- rc = -9;
- goto xpurge;
- }
- switch (k = cmresult.nresult) {
- case PU_KEEP:
- z = 1;
- if (c == ':' || c == '=') {
- if ((y = cmnum("How many backup files to keep",
- "1",10,&z,xxstring)) < 0) {
- rc = y;
- goto xpurge;
- }
- }
- if (z < 0 || z > MAXKEEP) {
- printf("?Please specify a number between 0 and %dn",
- MAXKEEP
- );
- rc = -9;
- goto xpurge;
- }
- tokeep = z;
- break;
- case PU_LIST:
- listing = 1;
- break;
- case PU_NOLI:
- listing = 0;
- break;
- #ifdef CK_TTGWSIZ
- case PU_PAGE:
- paging = 1;
- break;
- case PU_NOPA:
- paging = 0;
- break;
- #endif /* CK_TTGWSIZ */
- case PU_DELE:
- deleting = 1;
- break;
- case PU_NODE:
- deleting = 0;
- simulate = 1;
- listing = 1;
- break;
- case PU_ASK:
- asking = 1;
- break;
- case PU_NASK:
- asking = 0;
- break;
- case PU_AFT:
- case PU_BEF:
- case PU_NAF:
- case PU_NBF:
- if ((x = cmdate("File-time","",&s,0,xxstring)) < 0) {
- if (x == -3) {
- printf("?Date-time requiredn");
- rc = -9;
- } else
- rc = x;
- goto xpurge;
- }
- fs++;
- switch (k) {
- case PU_AFT: makestr(&pu_aft,s); break;
- case PU_BEF: makestr(&pu_bef,s); break;
- case PU_NAF: makestr(&pu_naf,s); break;
- case PU_NBF: makestr(&pu_nbf,s); break;
- }
- break;
- case PU_SMA:
- case PU_LAR:
- if ((x = cmnum("File size in bytes","0",10,&y,xxstring)) < 0) {
- rc = x;
- goto xpurge;
- }
- fs++;
- switch (cmresult.nresult) {
- case PU_SMA: minsize = y; break;
- case PU_LAR: maxsize = y; break;
- }
- break;
- case PU_DOT:
- matchdot = 1;
- break;
- case PU_NODOT:
- matchdot = 0;
- break;
- case PU_EXC:
- if ((x = cmfld("Pattern","",&s,xxstring)) < 0) {
- if (x == -3) {
- printf("?Pattern requiredn");
- rc = -9;
- } else
- rc = x;
- goto xpurge;
- }
- fs++;
- makestr(&pu_exc,s);
- break;
- case PU_HDG:
- x_hdg = 1;
- break;
- #ifdef RECURSIVE
- case PU_RECU: /* /RECURSIVE */
- recursive = 2;
- break;
- #endif /* RECURSIVE */
- default:
- printf("?Not implemented yet - "%s"n",atmbuf);
- rc = -9;
- goto xpurge;
- }
- } else if (cmresult.fcode == _CMIFI) {
- havename = 1;
- } else if (cmresult.fcode == _CMCFM) {
- confirmed = 1;
- } else {
- rc = -2;
- goto xpurge;
- }
- }
- if (havename) {
- #ifdef CKREGEX
- sprintf(line,"%s.~[1-9]*~",cmresult.sresult);
- #else
- sprintf(line,"%s.~*~",cmresult.sresult);
- #endif /* CKREGEX */
- } else {
- #ifdef CKREGEX
- strcpy(line,"*.~[1-9]*~");
- #else
- strcpy(line,"*.~*~");
- #endif /* CKREGEX */
- }
- if (!confirmed) {
- if ((x = cmcfm()) < 0) {
- rc = x;
- goto xpurge;
- }
- }
- /* Parse finished - now action */
- #ifdef CK_LOGIN
- if (isguest) {
- printf("?File deletion by guests not permitted.n");
- rc = -9;
- goto xpurge;
- }
- #endif /* CK_LOGIN */
- #ifdef CK_TTGWSIZ
- if (paging < 0) /* /[NO]PAGE not given */
- paging = xaskmore; /* so use prevailing */
- #endif /* CK_TTGWSIZ */
- lines = 0;
- if (x_hdg > 0) {
- printf("Purging %s, keeping %d...%sn",
- s,
- tokeep,
- simulate ? " (SIMULATION)" : "");
- lines += 2;
- }
- flags = ZX_FILONLY;
- if (recursive) flags |= ZX_RECURSE;
- n = nzxpand(line,flags); /* Get list of backup files */
- if (tokeep < 1) { /* Deleting all of them... */
- for (i = 0; i < n; i++) {
- if (fs) if (fileselect(mtchs[i],
- pu_aft,pu_bef,pu_naf,pu_nbf,
- minsize,maxsize,0,8,pxlist) < 1) {
- if (listing > 0) {
- printf(" %s (SKIPPED)n",mtchs[i]);
- #ifdef CK_TTGWSIZ
- if (paging)
- if (++lines > cmd_rows - 3) {
- if (!askmore()) goto xpurge; else lines = 0;
- }
- #endif /* CK_TTGWSIZ */
- }
- continue;
- }
- if (asking) {
- int x;
- sprintf(tmpbuf," Delete %s? ",mtchs[i]);
- x = getyesno(tmpbuf,1);
- switch (x) {
- case 0: continue;
- case 1: break;
- case 2: goto xpurge;
- }
- }
- x = deleting ? zdelet(mtchs[i]) : 0;
- if (x > -1) {
- if (listing)
- printf(" %s (%s)n", mtchs[i],deleting ? "OK" : "SELECTED");
- count++;
- } else {
- errors++;
- if (listing)
- printf(" %s (FAILED)n", mtchs[i]);
- }
- #ifdef CK_TTGWSIZ
- if (listing && paging)
- if (++lines > cmd_rows - 3) {
- if (!askmore()) goto xpurge; else lines = 0;
- }
- #endif /* CK_TTGWSIZ */
- }
- goto xpurge;
- }
- if (n < tokeep) { /* Not deleting any */
- count = 0;
- if (listing)
- printf(" Matches = %d: Not enough to purge.n");
- goto xpurge;
- }
- /* General case - delete some but not others */
- sh_sort(mtchs,NULL,n,0,0,filecase); /* Alphabetize the list (ESSENTIAL) */
- g = 0; /* Start of current group */
- for (i = 0; i < n; i++) { /* Go thru sorted file list */
- x = znext(namebuf); /* Get next file */
- if (x < 1 || !namebuf[0] || i == n - 1) /* No more? */
- done = 1; /* NOTE: 'done' must be 0 or 1 only */
- if (fs) if (fileselect(namebuf,
- pu_aft,pu_bef,pu_naf,pu_nbf,
- minsize,maxsize,0,8,pxlist) < 1) {
- if (listing > 0) {
- printf(" %s (SKIPPED)n",namebuf);
- if (++lines > cmd_rows - 3)
- if (!askmore()) goto xpurge; else lines = 0;
- }
- continue;
- }
- if (x > 0)
- if ((m = bkupnum(namebuf,&z)) < 0) /* This file's backup number. */
- continue;
- for (j = 0; j < tokeep; j++) { /* Insert in list. */
- if (m > xx[j]) {
- for (k = tokeep - 1; k > j; k--)
- xx[k] = xx[k-1];
- xx[j] = m;
- break;
- }
- }
- /* New group? */
- if (done || (i > 0 && ckstrcmp(namebuf,basebuf,z,1))) {
- if (i + done - g > tokeep) { /* Do we have enough to purge? */
- min = xx[tokeep-1]; /* Yes, lowest backup number to keep */
- debug(F111,"dopurge group",basebuf,min);
- for (j = g; j < i + done; j++) { /* Go through this group */
- x = bkupnum(mtchs[j],&z); /* Get file backup number */
- if (x > 0 && x < min) { /* Below minimum? */
- x = deleting ? zdelet(mtchs[j]) : 0;
- if (x < 0) errors++;
- if (listing)
- printf(" %s (%s)n",
- mtchs[j],
- ((x < 0) ? "ERROR" :
- (deleting ? "DELETED" : "SELECTED"))
- );
- count++;
- } else if (listing) /* Not below minimum - keep this one */
- printf(" %s (KEPT)n",mtchs[j]);
- #ifdef CK_TTGWSIZ
- if (listing && paging)
- if (++lines > cmd_rows - 3) {
- if (!askmore()) goto xpurge; else lines = 0;
- }
- #endif /* CK_TTGWSIZ */
- }
- } else if (listing && paging) { /* Not enough to purge */
- printf(" %s.~*~ (KEPT)n",basebuf);
- #ifdef CK_TTGWSIZ
- if (++lines > cmd_rows - 3) {
- if (!askmore()) goto xpurge; else lines = 0;
- }
- #endif /* CK_TTGWSIZ */
- }
- for (j = 0; j < tokeep; j++) /* Clear the backup number list */
- xx[j] = 0;
- g = i; /* Reset the group pointer */
- }
- if (done) /* No more files, done. */
- break;
- strncpy(basebuf,namebuf,z); /* Set basename of this file */
- basebuf[z] = NUL;
- }
- xpurge: /* Common exit point */
- if (g_matchdot > -1) {
- matchdot = g_matchdot; /* Restore these... */
- g_matchdot = -1;
- }
- #ifdef CK_TTGWSIZ
- if (saveask > -1) {
- xaskmore = saveask;
- saveask = -1;
- }
- #endif /* CK_TTGWSIZ */
- if (rc < 0) return(rc); /* Parse error */
- if (x_hdg)
- printf("Files purged: %d%sn",
- count,
- deleting ? "" : " (not really)"
- );
- return(success = count > 0 ? 1 : (errors > 0) ? 0 : 1);
- }
- #endif /* CKPURGE */
- #ifndef NOXFER
- #ifndef NOLOCAL
- int
- doxdis() {
- extern int nolocal;
- int x, y = 0, z;
- #ifdef COMMENT
- char *s;
- #endif /* COMMENT */
- if ((x = cmkey(fdtab,nfdtab,"file transfer display style","",
- xxstring)) < 0)
- return(x);
- #ifdef CK_PCT_BAR
- if ((y = cmkey(fdftab,2,"","thermometer",xxstring)) < 0)
- return(y);
- #endif /* CK_PCT_BAR */
- if ((z = cmcfm()) < 0) return(z);
- #ifdef CK_CURSES
- if (x == XYFD_C) { /* FULLSCREEN */
- #ifdef COMMENT
- #ifndef MYCURSES
- extern char * trmbuf; /* Real curses */
- int z;
- #endif /* MYCURSES */
- #endif /* COMMENT */
- if (nolocal) /* Nothing to do in this case */
- return(success = 1);
- #ifdef COMMENT
- #ifndef MYCURSES
- #ifndef VMS
- s = getenv("TERM");
- debug(F110,"doxdis TERM",s,0);
- if (!s) s = "";
- fxdinit(x);
- if (*s && trmbuf) { /* Don't call tgetent */
- z = tgetent(trmbuf,s); /* if trmbuf not allocated */
- debug(F111,"doxdis tgetent",s,z);
- } else {
- z = 0;
- debug(F110,"doxdis tgetent skipped",s,0);
- }
- if (z < 1) {
- printf("Sorry, terminal type unknown: "%s"n",s);
- return(success = 0);
- }
- #endif /* VMS */
- #endif /* MYCURSES */
- #else
- fxdinit(x);
- #endif /* COMMENT */
- #ifdef CK_PCT_BAR
- thermometer = y;
- #endif /* CK_PCT_BAR */
- line[0] = ' '; /* (What's this for?) */
- }
- #endif /* CK_CURSES */
- fdispla = x; /* It's OK. */
- return(success = 1);
- }
- #endif /* NOLOCAL */
- #endif /* NOXFER */
- int
- setfil(rmsflg) int rmsflg; {
- #ifndef NOXFER
- if (rmsflg) {
- if ((y = cmkey(rfiltab,nrfilp,"Remote file parameter","",
- xxstring)) < 0) {
- if (y == -3) {
- printf("?Remote file parameter requiredn");
- return(-9);
- } else return(y);
- }
- } else {
- #endif /* NOXFER */
- if ((y = cmkey(filtab,nfilp,"File parameter","",xxstring)) < 0)
- return(y);
- #ifndef NOXFER
- }
- #endif /* NOXFER */
- switch (y) {
- #ifdef COMMENT /* Not needed */
- case XYFILB: /* Blocksize */
- if ((y = cmnum("file block size",ckitoa(DBLKSIZ),10,&z,xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0) return(x);
- if (rmsflg) {
- sstate = setgen('S', "311", ckitoa(z), "");
- return((int) sstate);
- } else {
- fblksiz = z;
- return(success = 1);
- }
- #endif /* COMMENT */
- #ifndef NOXFER
- case XYFILS: /* Byte size */
- if ((y = cmnum("file byte size (7 or 8)","8",10,&z,xxstring)) < 0)
- return(y);
- if (z != 7 && z != 8) {
- printf("n?The choices are 7 and 8n");
- return(0);
- }
- if ((y = cmcfm()) < 0) return(y);
- if (z == 7) fmask = 0177;
- else if (z == 8) fmask = 0377;
- return(success = 1);
- #ifndef NOCSETS
- case XYFILC: { /* Character set */
- char * csetname = NULL;
- extern int
- r_cset, s_cset, afcset[]; /* SEND CHARACTER-SET AUTO or MANUAL */
- struct FDB kw, fl;
- cmfdbi(&kw, /* First FDB - command switches */
- _CMKEY, /* fcode */
- rmsflg ? "server character-set name" : "", /* help */
- "", /* default */
- "", /* addtl string data */
- nfilc, /* addtl numeric data 1: tbl size */
- 0, /* addtl numeric data 2: 0 = keyword */
- xxstring, /* Processing function */
- fcstab, /* Keyword table */
- rmsflg ? &fl : NULL /* 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 */
- xxstring,
- NULL,
- NULL
- );
- if ((x = cmfdb(&kw)) < 0)
- return(x);
- if (cmresult.fcode == _CMKEY) {
- x = cmresult.nresult;
- csetname = fcsinfo[x].keyword;
- } else {
- ckstrncpy(line,cmresult.sresult,LINBUFSIZ);
- csetname = line;
- }
- if ((z = cmcfm()) < 0) return(z);
- if (rmsflg) {
- sstate = setgen('S', "320", csetname, "");
- return((int) sstate);
- }
- fcharset = x;
- if (s_cset == XMODE_A) /* If SEND CHARACTER-SET is AUTO */
- if (x > -1 && x <= MAXFCSETS)
- if (afcset[x] > -1 && afcset[x] <= MAXTCSETS)
- tcharset = afcset[x]; /* Pick corresponding xfer charset */
- setxlatype(tcharset,fcharset); /* Translation type */
- /* If I say SET FILE CHARACTER-SET blah, I want to be blah! */
- r_cset = XMODE_M; /* Don't switch incoming set! */
- return(success = 1);
- }
- #endif /* NOCSETS */
- #ifndef NOLOCAL
- case XYFILD: /* Display */
- return(doxdis());
- #endif /* NOLOCAL */
- #endif /* NOXFER */
- case XYFILA: /* End-of-line */
- #ifdef NLCHAR
- s = "";
- if (NLCHAR == 015)
- s = "cr";
- else if (NLCHAR == 012)
- s = "lf";
- if ((x = cmkey(eoltab, neoltab,
- "local text-file line terminator",s,xxstring)) < 0)
- return(x);
- #else
- if ((x = cmkey(eoltab, neoltab,
- "local text-file line terminator","crlf",xxstring)) < 0)
- return(x);
- #endif /* NLCHAR */
- if ((z = cmcfm()) < 0) return(z);
- feol = (CHAR) x;
- return(success = 1);
- #ifndef NOXFER
- case XYFILN: /* Names */
- if ((x = cmkey(fntab,nfntab,"how to handle filenames","converted",
- xxstring)) < 0)
- return(x);
- if ((z = cmcfm()) < 0) return(z);
- if (rmsflg) {
- sstate = setgen('S', "301", ckitoa(1 - x), "");
- return((int) sstate);
- } else {
- ptab[protocol].fncn = x; /* Set structure */
- fncnv = x; /* Set variable */
- f_save = x; /* Set and set "permanent" variable */
- return(success = 1);
- }
- case XYFILR: /* Record length */
- if ((y = cmnum("file record length",
- ckitoa(DLRECL),10,&z,xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0) return(x);
- if (rmsflg) {
- sstate = setgen('S', "312", ckitoa(z), "");
- return((int) sstate);
- } else {
- frecl = z;
- return(success = 1);
- }
- #ifdef COMMENT
- case XYFILO: /* Organization */
- if ((x = cmkey(forgtab,nforg,"file organization","sequential",
- xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- if (rmsflg) {
- sstate = setgen('S', "314", ckitoa(x), "");
- return((int) sstate);
- } else {
- forg = x;
- return(success = 1);
- }
- #endif /* COMMENT */
- #ifdef COMMENT /* Not needed */
- case XYFILF: /* Format */
- if ((x = cmkey(frectab,nfrec,"file record format","stream",
- xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- if (rmsflg) {
- sstate = setgen('S', "313", ckitoa(x), "");
- return((int) sstate);
- } else {
- frecfm = x;
- return(success = 1);
- }
- #endif /* COMMENT */
- #ifdef COMMENT
- case XYFILP: /* Printer carriage control */
- if ((x = cmkey(fcctab,nfcc,"file carriage control","newline",
- xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- if (rmsflg) {
- sstate = setgen('S', "315", ckitoa(x), "");
- return((int) sstate);
- } else {
- fcctrl = x;
- return(success = 1);
- }
- #endif /* COMMENT */
- #endif /* NOXFER */
- case XYFILT: /* Type */
- if ((x = cmkey(rmsflg ? rfttab : fttab,
- rmsflg ? nrfttyp : nfttyp,
- "type of file transfer","text",xxstring)) < 0)
- return(x);
- #ifdef VMS
- /* Allow VMS users to choose record format for binary files */
- if ((x == XYFT_B) && (rmsflg == 0)) {
- if ((x = cmkey(fbtab,nfbtyp,"VMS record format","fixed",
- xxstring)) < 0)
- return(x);
- }
- #endif /* VMS */
- if ((y = cmcfm()) < 0) return(y);
- binary = x;
- b_save = x;
- #ifdef MAC
- (void) mac_setfildflg(binary);
- #endif /* MAC */
- #ifndef NOXFER
- if (rmsflg) {
- /* Allow for LABELED in VMS & OS/2 */
- sstate = setgen('S', "300", ckitoa(x), "");
- return((int) sstate);
- } else {
- #endif /* NOXFER */
- return(success = 1);
- #ifndef NOXFER
- }
- #endif /* NOXFER */
- #ifndef NOXFER
- case XYFILX: /* Collision Action */
- if ((x = cmkey(colxtab,ncolx,"Filename collision action","backup",
- xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- #ifdef CK_LOGIN
- if (isguest) {
- /* Don't let guests change existing files */
- printf("?This command not valid for guestsn");
- return(-9);
- }
- #endif /* CK_LOGIN */
- fncact = x;
- ptab[protocol].fnca = x;
- if (rmsflg) {
- sstate = setgen('S', "302", ckitoa(fncact), "");
- return((int) sstate);
- } else {
- if (fncact == XYFX_R) ckwarn = 1; /* FILE WARNING implications */
- if (fncact == XYFX_X) ckwarn = 0; /* ... */
- return(success = 1);
- }
- case XYFILW: /* Warning/Write-Protect */
- if ((x = seton(&ckwarn)) < 0) return(x);
- if (ckwarn)
- fncact = XYFX_R;
- else
- fncact = XYFX_X;
- return(success = 1);
- #ifdef CK_LABELED
- case XYFILL: /* LABELED FILE parameters */
- if ((x = cmkey(lbltab,nlblp,"Labeled file feature","",
- xxstring)) < 0)
- return(x);
- if ((success = seton(&y)) < 0)
- return(success);
- if (y) /* Set or reset the selected bit */
- lf_opts |= x; /* in the options bitmask. */
- else
- lf_opts &= ~x;
- return(success);
- #endif /* CK_LABELED */
- case XYFILI: { /* INCOMPLETE */
- extern struct keytab ifdatab[];
- extern int keep;
- if ((y = cmkey(ifdatab,3,"","auto",xxstring)) < 0) return(y);
- if ((x = cmcfm()) < 0) return(x);
- if (rmsflg) {
- sstate = setgen('S',
- "310",
- y == 0 ? "0" : (y == 1 ? "1" : "2"),
- ""
- );
- return((int) sstate);
- } else {
- keep = y;
- return(success = 1);
- }
- }
- #ifdef CK_TMPDIR
- case XYFILG: { /* Download directory */
- int x;
- char *s;
- #ifdef ZFNQFP
- struct zfnfp * fnp;
- #endif /* ZFNQFP */
- #ifdef MAC
- char temp[34];
- #endif /* MAC */
- #ifdef GEMDOS
- if ((x = cmdir("Name of local directory, or carriage return",
- "",&s,
- NULL)) < 0 ) {
- if (x != -3)
- return(x);
- }
- #else
- #ifdef OS2
- if ((x = cmdir("Name of PC disk and/or directory,n
- or press the Enter key to use current directory",
- "",&s,xxstring)) < 0 ) {
- if (x != -3)
- return(x);
- }
- #else
- #ifdef MAC
- x = ckstrncpy(temp,homdir,32);
- if (x > 0) if (temp[x-1] != ':') { temp[x] = ':'; temp[x+1] = NUL; }
- if ((x = cmtxt("Name of Macintosh volume and/or folder,n
- or press the Return key for the desktop on the boot disk",
- temp,&s, xxstring)) < 0 )
- return(x);
- #else
- if ((x = cmdir("Name of local directory, or carriage return",
- "", &s, xxstring)) < 0 ) {
- if (x != -3)
- return(x);
- }
- #endif /* MAC */
- #endif /* OS2 */
- #endif /* GEMDOS */
- debug(F110,"download dir",s,0);
- #ifndef MAC
- if (x == 2) {
- printf("?Wildcards not allowed in directory namen");
- return(-9);
- }
- #endif /* MAC */
- #ifdef ZFNQFP
- if ((fnp = zfnqfp(s,TMPBUFSIZ - 1,tmpbuf))) {
- if (fnp->fpath)
- if ((int) strlen(fnp->fpath) > 0)
- s = fnp->fpath;
- }
- debug(F110,"download zfnqfp",s,0);
- #endif /* ZFNQFP */
- strcpy(line,s); /* Make a safe copy */
- s = line;
- #ifndef MAC
- if ((x = cmcfm()) < 0) /* Get confirmation */
- return(x);
- #endif /* MAC */
- #ifdef CK_LOGIN
- if (isguest) {
- /* Don't let guests change existing files */
- printf("?This command not valid for guestsn");
- return(-9);
- }
- #endif /* CK_LOGIN */
- x = strlen(line);
- #ifdef datageneral
- if (line[x-1] == ':') /* homdir ends in colon, */
- line[x-1] = NUL; /* and "dir" doesn't like that... */
- #endif /* datageneral */
- makestr(&dldir,line);
- return(success = (dldir != NULL));
- }
- #endif /* CK_TMPDIR */
- case XYFILY:
- return(setdest());
- #endif /* NOXFER */
- #ifdef CK_CTRLZ
- case XYFILV: { /* EOF */
- extern int eofmethod;
- if ((x = cmkey(eoftab,3,"end-of-file detection method","",
- xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0)
- return(y);
- eofmethod = x;
- return(success = 1);
- }
- #endif /* CK_CTRLZ */
- #ifndef NOXFER
- #ifdef UNIX
- case XYFILH: { /* OUTPUT */
- extern int zofbuffer, zobufsize, zofblock;
- #ifdef DYNAMIC
- extern char * zoutbuffer;
- #endif /* DYNAMIC */
- if ((x = cmkey(zoftab,nzoftab,"output file writing method","",
- xxstring)) < 0)
- return(x);
- if (x == ZOF_BUF || x == ZOF_NBUF) {
- if ((y = cmnum("output buffer size","32768",10,&z,xxstring)) < 0)
- return(y);
- if (z < 1) {
- printf("?Bad size - %dn", z);
- return(-9);
- }
- }
- if ((y = cmcfm()) < 0) return(y);
- switch (x) {
- case ZOF_BUF:
- case ZOF_NBUF:
- zofbuffer = (x == ZOF_BUF);
- zobufsize = z;
- break;
- case ZOF_BLK:
- case ZOF_NBLK:
- zofblock = (x == ZOF_BLK);
- break;
- }
- #ifdef DYNAMIC
- if (zoutbuffer) free(zoutbuffer);
- if (!(zoutbuffer = (char *)malloc(z))) {
- printf("MEMORY ALLOCATION ERROR - FATALn");
- doexit(BAD_EXIT,-1);
- } else
- zobufsize = z;
- #else
- if (z <= OBUFSIZE) {
- zobufsize = z;
- } else {
- printf("?Sorry, %d is too big - %d is the maximumn",z,OBUFSIZE);
- return(-9);
- }
- #endif /* DYNAMIC */
- return(success = 1);
- }
- #endif /* UNIX */
- #ifdef PATTERNS
- case XYFIBP: /* BINARY-PATTERN */
- case XYFITP: { /* TEXT-PATTERN */
- char * tmp[FTPATTERNS];
- int i, n = 0;
- while (n < FTPATTERNS) {
- tmp[n] = NULL;
- if ((x = cmfld("Pattern","",&s,xxstring)) < 0)
- break;
- strcpy(line,s);
- s = brstrip(line);
- makestr(&(tmp[n++]),s);
- }
- if (x == -3) x = cmcfm();
- for (i = 0; i <= n; i++) {
- if (x > -1) {
- if (y == XYFIBP)
- makestr(&(binpatterns[i]),tmp[i]);
- else
- makestr(&(txtpatterns[i]),tmp[i]);
- }
- free(tmp[i]);
- }
- if (y == XYFIBP) /* Null-terminate the list */
- makestr(&(binpatterns[i]),NULL);
- else
- makestr(&(txtpatterns[i]),NULL);
- return(x);
- }
- case XYFIPA: /* PATTERNS */
- if ((x = setonaut(&patterns)) < 0)
- return(x);
- return(success = 1);
- #endif /* PATTERNS */
- #endif /* NOXFER */
- #ifdef UNICODE
- case XYFILU: { /* UCS */
- extern int ucsorder, ucsbom, byteorder;
- if ((x = cmkey(ucstab,nucstab,"","",xxstring)) < 0)
- return(x);
- switch (x) {
- case UCS_BYT:
- if ((y = cmkey(botab,nbotab,
- "Byte order",
- byteorder ? "little-endian" : "big-endian",
- xxstring
- )
- ) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- ucsorder = y;
- return(success = 1);
- case UCS_BOM:
- if ((y = cmkey(onoff,2,"","on",xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- ucsbom = y;
- return(success = 1);
- default:
- return(-2);
- }
- }
- #endif /* UNICODE */
- case 9997: /* FASTLOOKUPS */
- return(success = seton(&stathack));
- default:
- printf("?unexpected file parametern");
- return(-2);
- }
- }
- #ifndef NOLOCAL
- #ifdef OS2
- /* MS-DOS KERMIT compatibility modes */
- int
- setmsk() {
- if ((y = cmkey(msktab,nmsk,"MS-DOS Kermit compatibility mode",
- "keycodes",xxstring)) < 0) return(y);
- switch ( y ) {
- #ifdef COMMENT
- case MSK_COLOR:
- return(seton(&mskcolors));
- #endif /* COMMENT */
- case MSK_KEYS:
- return(seton(&mskkeys));
- default: /* Shouldn't get here. */
- return(-2);
- }
- }
- #endif /* OS2 */
- int
- settrmtyp() {
- #ifdef OS2
- #ifdef TNCODE
- extern int ttnum; /* Last Telnet Terminal Type sent */
- extern int ttnumend; /* Has end of list been found */
- #endif /* TNCODE */
- if ((x = cmkey(ttyptab,nttyp,"","vt320",xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0)
- return(y);
- settermtype(x,1);
- #ifdef TNCODE
- /* So we send the correct terminal name to the host if it asks for it */
- ttnum = -1; /* Last Telnet Terminal Type sent */
- ttnumend = 0; /* end of list not found */
- #endif /* TNCODE */
- return(success = 1);
- #else /* Not OS2 */
- printf(
- "n Sorry, this version of C-Kermit does not support the SET TERMINAL TYPEn");
- printf(
- " command. Type "help set terminal" for further information.n");
- #endif /* OS2 */
- return(success = 0);
- }
- int
- settrm() {
- int i = 0;
- #ifdef OS2
- extern int colorreset, user_erasemode;
- #endif /* OS2 */
- if ((y = cmkey(trmtab,ntrm,"", "",xxstring)) < 0) return(y);
- #ifdef MAC
- printf("n?Sorry, not implemented yet. Please use the Settings menu.n");
- return(-9);
- #else
- #ifdef IKSD
- if (inserver) {
- if ((y = cmcfm()) < 0) return(y);
- printf("?Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- switch (y) {
- case XYTBYT: /* SET TERMINAL BYTESIZE */
- if ((y = cmnum("bytesize for terminal connection","8",10,&x,
- xxstring)) < 0)
- return(y);
- if (x != 7 && x != 8) {
- printf("n?The choices are 7 and 8n");
- return(success = 0);
- }
- if ((y = cmcfm()) < 0) return(y);
- if (x == 7) cmask = 0177;
- else if (x == 8) {
- cmask = 0377;
- parity = 0;
- }
- #ifdef OS2
- if (IS97801(tt_type_mode))
- SNI_bitmode(x);
- #endif /* OS2 */
- return(success = 1);
- case XYTSO: /* SET TERMINAL LOCKING-SHIFT */
- return(seton(&sosi));
- case XYTNL: /* SET TERMINAL NEWLINE-MODE */
- return(seton(&tnlm));
- #ifdef OS2
- case XYTCOL:
- if ((x = cmkey(ttycoltab,ncolors,"","terminal",xxstring)) < 0)
- return(x);
- else if (x == TTCOLRES) {
- if ((y = cmkey(ttcolmodetab,ncolmode,
- "","default-color",xxstring)) < 0)
- return(y);
- if ((z = cmcfm()) < 0)
- return(z);
- colorreset = y;
- return(success = 1);
- } else if (x == TTCOLERA) {
- if ((y = cmkey(ttcolmodetab,ncolmode,"",
- "current-color",xxstring)) < 0)
- return(y);
- if ((z = cmcfm()) < 0)
- return(z);
- user_erasemode = y;
- return(success=1);
- } else { /* No parse error */
- int fg = 0, bg = 0;
- fg = cmkey(ttyclrtab, nclrs,
- (x == TTCOLBOR ?
- "color for screen border" :
- "foreground color and then background color"),
- "lgray", xxstring);
- if (fg < 0)
- return(fg);
- if (x != TTCOLBOR) {
- if ((bg = cmkey(ttyclrtab,nclrs,
- "background color","blue",xxstring)) < 0)
- return(bg);
- }
- if ((y = cmcfm()) < 0)
- return(y);
- switch (x) {
- case TTCOLNOR:
- colornormal = fg | bg << 4;
- fgi = fg & 0x08;
- bgi = bg & 0x08;
- break;
- case TTCOLREV:
- colorreverse = fg | bg << 4;
- break;
- case TTCOLUND:
- colorunderline = fg | bg << 4;
- break;
- case TTCOLGRP:
- colorgraphic = fg | bg << 4;
- break;
- case TTCOLDEB:
- colordebug = fg | bg << 4;
- break;
- case TTCOLSTA:
- colorstatus = fg | bg << 4;
- break;
- case TTCOLHLP:
- colorhelp = fg | bg << 4;
- break;
- case TTCOLBOR:
- colorborder = fg;
- break;
- case TTCOLSEL:
- colorselect = fg | bg << 4;
- break;
- default:
- printf("%s - invalidn",cmdbuf);
- return(-9);
- break;
- }
- scrninitialized[VTERM] = 0;
- VscrnInit(VTERM);
- }
- return(success = 1);
- case XYTCUR: { /* SET TERMINAL CURSOR */
- extern int cursorena[];
- extern int cursoron[] ; /* Cursor state on/off */
- if ((x = cmkey(ttycurtab,ncursors,"","underline",xxstring)) < 0)
- return(x);
- if ((z = cmkey(onoff,2,"","on",xxstring)) < 0)
- return(z);
- if ((y = cmcfm()) < 0) return(y);
- tt_cursor = tt_cursor_usr = x;
- cursorena[VTERM] = tt_cursorena_usr = z;/* turn cursor on/off */
- cursoron[VTERM] = FALSE; /* Force newcursor to restore the cursor */
- return(success = 1);
- }
- #endif /* OS2 */
- case XYTTYP: /* SET TERMINAL TYPE */
- return(settrmtyp());
- #ifdef OS2
- case XYTARR: /* SET TERMINAL ARROW-KEYS */
- if ((x = cmkey(akmtab,2,"","",xxstring)) < 0) return(x);
- if ((y = cmcfm()) < 0) return(y);
- tt_arrow = x; /* TTK_NORM / TTK_APPL; see ckuusr.h */
- return(success = 1);
- case XYTKPD: /* SET TERMINAL KEYPAD-MODE */
- if ((x = cmkey(kpmtab,2,"","",xxstring)) < 0) return(x);
- if ((y = cmcfm()) < 0) return(y);
- tt_keypad = x; /* TTK_NORM / TTK_APPL; see ckuusr.h */
- return(success = 1);
- case XYTUNX: { /* SET TERM UNIX-MODE (DG) */
- extern int dgunix,dgunix_usr;
- x = seton(&dgunix);
- dgunix_usr = dgunix;
- return(x);
- }
- case XYTKBMOD: { /* SET TERM KEYBOARD MODE */
- extern int tt_kb_mode;
- if ((x = cmkey(kbmodtab,
- nkbmodtab,
- "normal",
- "special keyboard mode for terminal emulation",
- xxstring)
- ) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- tt_kb_mode = x;
- return(success = 1);
- }
- case XYTWRP: /* SET TERMINAL WRAP */
- return(seton(&tt_wrap));
- case XYSCRS:
- if ((y = cmnum("CONNECT scrollback buffer size, lines","2000",10,&x,
- xxstring)) < 0)
- return(y);
- /* The max number of lines is the RAM */
- /* we can actually dedicate to a */
- /* scrollback buffer given the maximum */
- /* process memory space of 512MB */
- if (x < 256 || x > 2000000L) {
- printf("n?The size must be between 256 and 2,000,000.n");
- return(success = 0);
- }
- if ((y = cmcfm()) < 0) return(y);
- tt_scrsize[VTERM] = x;
- VscrnInit(VTERM);
- return(success = 1);
- #endif /* OS2 */
- #ifndef NOCSETS
- #ifndef KUI
- case XYTCS: /* SET TERMINAL CHARACTER-SET */
- /* set terminal character-set <remote> <local> */
- if ((x = cmkey(
- #ifdef CKOUNI
- txrtab,ntxrtab,
- #else /* CKOUNI */
- ttcstab,ntermc,
- #endif /* CKOUNI */
- "remote terminal character-set","",xxstring)) < 0)
- return(x);
- if (
- #ifdef CKOUNI
- x == TX_TRANSP
- #else /* CKOUNI */
- x == FC_TRANSP
- #endif /* CKOUNI */
- ) { /* TRANSPARENT? */
- if ((x = cmcfm()) < 0) return(x); /* Confirm the command */
- #ifdef CKOUNI
- tt_utf8 = 0; /* Turn off the UTF8 flag */
- tcsr = tcsl = TX_ASCII; /* Make them both the same */
- #else /* CKOUNI */
- tcsr = tcsl = FC_USASCII;
- #endif /* CKOUNI */
- tcs_transp = 1;
- #ifdef OS2
- #ifdef UNICODE
- dec_kbd = tcsr = tcsl = TX_TRANSP;
- #else /* UNICODE */
- y = os2getcp(); /* Default is current code page */
- switch (y) {
- case 437: tcsr = tcsl = FC_CP437; break;
- case 850: tcsr = tcsl = FC_CP850; break;
- case 852: tcsr = tcsl = FC_CP852; break;
- case 862: tcsr = tcsl = FC_CP862; break;
- case 866: tcsr = tcsl = FC_CP866; break;
- }
- #endif /* UNICODE */
- #ifdef UNICODE
- if (!cs_is_nrc(tcsl)) {
- G[0].def_designation = G[0].designation = TX_ASCII;
- G[0].init = TRUE;
- G[0].def_c1 = G[0].c1 = FALSE;
- G[0].size = cs94;
- G[0].national = FALSE;
- dec_nrc = TX_ASCII;
- } else
- dec_nrc = tcsl;
- for (i = cs_is_nrc(tcsl) ? 0 : 1; i < 4; i++) {
- G[i].def_designation = G[i].designation = tcsl;
- G[i].init = TRUE;
- G[i].def_c1 = G[i].c1 = FALSE;
- switch (cs_size(G[i].designation)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[i].national = cs_is_nrc(x);
- }
- #else /* UNICODE */
- for (i = 0; i < 4; i++) {
- G[i].def_designation = G[i].designation = FC_TRANSP;
- G[i].init = FALSE;
- G[i].size = G[i].def_size = cs96;
- G[i].c1 = G[i].def_c1 = FALSE;
- G[i].national = FALSE;
- G[i].rtoi = NULL;
- G[i].itol = NULL;
- G[i].ltoi = NULL;
- G[i].itor = NULL;
- }
- #endif /* UNICODE */
- #endif /* OS2 */
- return(success = 1);
- }
- tcs_transp = 0;
- #ifdef CKOUNI
- if (x == TX_UTF8) {
- if ((x = cmcfm()) < 0) /* Confirm the command */
- return(x);
- tt_utf8 = 1; /* Turn this on if we are UTF8 */
- return(success = 1);
- }
- #endif /* CKOUNI */
- /* Not transparent or UTF8, so get local set to translate it into */
- s = "";
- #ifdef OS2
- y = os2getcp(); /* Default is current code page */
- switch (y) {
- case 437: s = "cp437"; break;
- case 850: s = "cp850"; break;
- case 852: s = "cp852"; break;
- case 857: s = "cp857"; break;
- case 858: s = "cp858"; break;
- case 862: s = "cp862"; break;
- case 866: s = "cp866"; break;
- case 869: s = "cp869"; break;
- case 1250: s = "cp1250"; break;
- case 1251: s = "cp1251"; break;
- case 1252: s = "cp1252"; break;
- case 1253: s = "cp1253"; break;
- case 1254: s = "cp1254"; break;
- case 1255: s = "cp1255"; break;
- case 1256: s = "cp1256"; break;
- case 1257: s = "cp1257"; break;
- case 1258: s = "cp1258"; break;
- }
- #ifdef OS2ONLY
- /*
- If the user has loaded a font with SET TERMINAL FONT then we want
- to change the default code page to the font that was loaded.
- */
- if (tt_font != TTF_ROM) {
- for (y = 0; y < ntermfont; y++ ) {
- if (termfont[y].kwval == tt_font) {
- s = termfont[y].kwd;
- break;
- }
- }
- }
- #endif /* OS2ONLY */
- #else /* Not K95... */
- s = fcsinfo[fcharset].keyword;
- #endif /* OS2 */
- if ((y = cmkey(
- #ifdef CKOUNI
- txrtab,ntxrtab,
- #else /* CKOUNI */
- ttcstab,ntermc,
- #endif /* CKOUNI */
- "local character-set",s,xxstring)) < 0)
- return(y);
- #ifdef UNICODE
- if (y == TX_UTF8) {
- printf("?UTF8 may not be used as a local character set.rn");
- return(-9);
- }
- #endif /* UNICODE */
- #ifdef OS2
- if ((z = cmkey(graphsettab,ngraphset,
- "DEC VT intermediate graphic set","all",xxstring)) < 0)
- return(z);
- {
- int eol;
- if ((eol = cmcfm()) < 0)
- return(eol); /* Confirm the command */
- }
- tcsr = x; /* Remote character set */
- tcsl = y; /* Local character set */
- #ifdef CKOUNI
- tt_utf8 = 0; /* Turn off UTF8 flag */
- #endif /* CKOUNI */
- if (z == TT_GR_ALL) {
- int i;
- #ifdef UNICODE
- dec_kbd = x;
- #endif /* UNICODE */
- for (i = 0; i < 4; i++) {
- G[i].def_designation = G[i].designation = x;
- G[i].init = TRUE;
- switch (cs_size(x)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[i].c1 = G[i].def_c1 = x != tcsl && cs_is_std(x);
- G[i].national = cs_is_nrc(x);
- }
- if (!cs_is_nrc(x)) {
- G[0].designation = G[0].def_designation = FC_USASCII;
- G[0].size = G[0].def_size = cs94;
- }
- #ifdef UNICODE
- } else if (z == TT_GR_KBD) { /* Keyboard only */
- dec_kbd = x;
- #endif /* UNICODE */
- } else { /* Specific Gn */
- G[z].def_designation = G[z].designation = x;
- G[z].init = TRUE;
- switch (cs_size(x)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[i].c1 = G[i].def_c1 = x != tcsl && cs_is_std(x);
- G[i].national = cs_is_nrc(x);
- }
- #else /* not OS2 */
- if ((z = cmcfm()) < 0) return(z); /* Confirm the command */
- tcsr = x; /* Remote character set */
- tcsl = y; /* Local character set */
- #endif /* OS2 */
- return(success = 1);
- #endif /* UNICODE */
- #endif /* NOCSETS */
- #ifndef NOCSETS
- case XYTLCS: /* SET TERMINAL LOCAL-CHARACTER-SET */
- /* set terminal character-set <local> */
- s = "";
- #ifdef OS2
- y = os2getcp(); /* Default is current code page */
- switch (y) {
- case 437: s = "cp437"; break;
- case 850: s = "cp850"; break;
- case 852: s = "cp852"; break;
- case 857: s = "cp857"; break;
- case 858: s = "cp858"; break;
- case 862: s = "cp862"; break;
- case 866: s = "cp866"; break;
- case 869: s = "cp869"; break;
- case 1250: s = "cp1250"; break;
- case 1251: s = "cp1251"; break;
- case 1252: s = "cp1252"; break;
- case 1253: s = "cp1253"; break;
- case 1254: s = "cp1254"; break;
- case 1255: s = "cp1255"; break;
- case 1256: s = "cp1256"; break;
- case 1257: s = "cp1257"; break;
- case 1258: s = "cp1258"; break;
- }
- #ifdef OS2ONLY
- /*
- If the user has loaded a font with SET TERMINAL FONT then we want
- to change the default code page to the font that was loaded.
- */
- if (tt_font != TTF_ROM) {
- for (y = 0; y < ntermfont; y++ ) {
- if (termfont[y].kwval == tt_font) {
- s = termfont[y].kwd;
- break;
- }
- }
- }
- #endif /* OS2ONLY */
- #else /* OS2 */
- /* Make current file char set */
- for (y = 0; y <= nfilc; y++) /* be the default... */
- if (fcstab[y].kwval == fcharset) {
- s = fcstab[y].kwd;
- break;
- }
- #endif /* OS2 */
- if ((y = cmkey(
- #ifdef CKOUNI
- txrtab,ntxrtab,
- #else /* CKOUNI */
- fcstab,nfilc,
- #endif /* CKOUNI */
- "local character-set",s,xxstring)) < 0)
- return(y);
- #ifdef UNICODE
- if (y == TX_UTF8) {
- printf("?UTF8 may not be used as a local character set.rn");
- return(-9);
- }
- #endif /* UNICODE */
- #ifdef OS2
- if ((z = cmcfm()) < 0) return(z); /* Confirm the command */
- tcsl = y; /* Local character set */
- {
- int i;
- for (i = 0; i < 4; i++) {
- G[i].init = TRUE;
- x = G[i].designation;
- G[i].c1 = (x != tcsl) && cs_is_std(x);
- x = G[i].def_designation;
- G[i].def_c1 = (x != tcsl) && cs_is_std(x);
- }
- }
- #else /* not OS2 */
- if ((z = cmcfm()) < 0) return(z); /* Confirm the command */
- tcsl = y; /* Local character set */
- #endif /* OS2 */
- return(success = 1);
- #endif /* NOCSETS */
- #ifndef NOCSETS
- #ifdef UNICODE
- case XYTUNI: /* SET TERMINAL UNICODE */
- return(seton(&tt_unicode));
- #endif /* UNICODE */
- case XYTRCS: /* SET TERMINAL REMOTE-CHARACTER-SET */
- /* set terminal character-set <remote> <Graphic-set> */
- if ((x = cmkey(
- #ifdef CKOUNI
- txrtab, ntxrtab,
- #else /* CKOUNI */
- ttcstab,ntermc,
- #endif /* CKOUNI */
- "remote terminal character-set","",xxstring)) < 0)
- return(x);
- /* KUI can't have a Transparent Character Set */
- #ifdef UNICODE
- if (x == TX_TRANSP)
- #else /* UNICODE */
- if (x == FC_TRANSP)
- #endif /* UNICODE */
- { /* TRANSPARENT? */
- if ((x = cmcfm()) < 0) /* Confirm the command */
- return(x);
- #ifndef OS2
- tcsr = tcsl; /* Make both sets the same */
- #else
- #ifdef CKOUNI
- tt_utf8 = 0; /* Turn off UTF8 flag */
- tcsr = tcsl = dec_kbd = TX_TRANSP; /* No translation */
- if (!cs_is_nrc(tcsl)) {
- G[0].def_designation = G[i].designation = TX_ASCII;
- G[0].init = TRUE;
- G[0].def_c1 = G[i].c1 = FALSE;
- G[0].size = cs94;
- G[0].national = FALSE;
- }
- for (i = cs_is_nrc(tcsl) ? 0 : 1; i < 4; i++) {
- G[i].def_designation = G[i].designation = tcsl;
- G[i].init = TRUE;
- G[i].def_c1 = G[i].c1 = FALSE;
- switch (cs_size(G[i].designation)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[i].national = cs_is_nrc(x);
- }
- #else /* CKOUNI */
- tcsr = tcsl; /* Make both sets the same */
- for (i = 0; i < 4; i++) {
- G[i].def_designation = G[i].designation = FC_TRANSP;
- G[i].init = FALSE;
- G[i].size = G[i].def_size = cs96;
- G[i].c1 = G[i].def_c1 = FALSE;
- G[i].rtoi = NULL;
- G[i].itol = NULL;
- G[i].ltoi = NULL;
- G[i].itor = NULL;
- G[i].national = FALSE;
- }
- #endif /* CKOUNI */
- #endif /* OS2 */
- return(success = 1);
- }
- #ifdef CKOUNI
- if (x == TX_UTF8) {
- if ((x = cmcfm()) < 0) return(x); /* Confirm the command */
- tt_utf8 = 1; /* Turn it on if we are UTF8 */
- return(success = 1);
- }
- #endif /* CKOUNI */
- #ifdef OS2
- if ((z = cmkey(graphsettab,ngraphset,
- "DEC VT intermediate graphic set","all",xxstring)) < 0)
- return(z);
- {
- int eol;
- if ((eol = cmcfm()) < 0) /* Confirm the command */
- return(eol);
- }
- tcsr = x; /* Remote character set */
- #ifdef CKOUNI
- tt_utf8 = 0; /* Turn off UTF8 flag */
- #endif /* CKOUNI */
- if (z == TT_GR_ALL) {
- int i;
- #ifdef UNICODE
- dec_kbd = x;
- #endif /* UNICODE */
- for (i = 0; i < 4; i++) {
- G[i].def_designation = G[i].designation = x;
- G[i].init = TRUE;
- switch (cs_size(x)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[i].c1 = G[i].def_c1 = x != tcsl && cs_is_std(x);
- G[i].national = cs_is_nrc(x);
- }
- if (!cs_is_nrc(x)) {
- G[0].designation = G[0].def_designation = FC_USASCII;
- G[0].size = G[0].def_size = cs94;
- }
- #ifdef UNICODE
- } else if (z == TT_GR_KBD) { /* Keyboard only */
- dec_kbd = x;
- #endif /* UNICODE */
- } else { /* Specific Gn */
- G[z].def_designation = G[z].designation = x;
- G[z].init = TRUE;
- switch (cs_size(x)) { /* 94, 96, or 128 */
- case 128:
- case 96:
- G[i].size = G[i].def_size = cs96;
- break;
- case 94:
- G[i].size = G[i].def_size = cs94;
- break;
- default:
- G[i].size = G[i].def_size = csmb;
- break;
- }
- G[z].c1 = G[z].def_c1 = x != tcsl && cs_is_std(x);
- G[z].national = cs_is_nrc(x);
- }
- #else /* not OS2 */
- if ((z = cmcfm()) < 0) return(z); /* Confirm the command */
- tcsr = x; /* Remote character set */
- #endif /* OS2 */
- return(success = 1);
- #endif /* NOCSETS */
- case XYTEC: /* SET TERMINAL ECHO */
- if ((x = cmkey(rltab,nrlt,"which side echos during CONNECT",
- "remote", xxstring)) < 0) return(x);
- if ((y = cmcfm()) < 0) return(y);
- duplex = x;
- return(success = 1);
- case XYTESC: /* SET TERM ESC */
- if ((x = cmkey(nabltab,nnabltab,"","enabled",xxstring)) < 0)
- return(x);
- if ((y = cmcfm()) < 0) return(y);
- tt_escape = x;
- return(1);
- case XYTCRD: /* SET TERMINAL CR-DISPLAY */
- if ((x = cmkey(crdtab,2,"", "normal", xxstring)) < 0) return(x);
- if ((y = cmcfm()) < 0) return(y);
- tt_crd = x;
- return(success = 1);
- #ifdef OS2
- case XYTANS: { /* SET TERMINAL ANSWERBACK */
- /*
- NOTE: We let them enable and disable the answerback sequence, but we
- do NOT let them change it, and we definitely do not let the host set it.
- This is a security feature.
- As of 1.1.8 we allow the SET TERM ANSWERBACK MESSAGE <string> to be
- used just as MS-DOS Kermit does. C0 and C1 controls as well as DEL
- are not allowed to be used as characters. They are translated to
- underscore. This may not be set by APC.
- */
- if ((x = cmkey(anbktab,nansbk,"", "off", xxstring)) < 0)
- return(x);
- if (x < 2) {
- if ((y = cmcfm()) < 0)
- return(y);
- tt_answer = x;
- return(success = 1);
- } else if ( x == 2 || x == 3) {
- int len = 0;
- extern int safeanswerbk;
- extern char useranswerbk[];
- if ((y = cmtxt("Answerback extension","",&s,xxstring)) < 0)
- return(y);
- if (apcactive == APC_LOCAL ||
- (apcactive == APC_REMOTE && apcstatus != APC_UNCH))
- return(success = 0);
- len = strlen(s);
- if (x == 2) {
- /* Safe Answerback's don't have C0/C1 chars */
- for (z = 0; z < len; z++) {
- if ((s[z] & 0x7F) <= SP || (s[z] & 0x7F) == DEL)
- useranswerbk[z] = '_';
- else
- useranswerbk[z] = s[z];
- }
- useranswerbk[z] = ' ';
- safeanswerbk = 1 ; /* TRUE */
- } else {
- ckstrncpy(useranswerbk,s,60); /* (see ckocon.c) */
- safeanswerbk = 0; /* FALSE */
- }
- updanswerbk();
- return(success = 1);
- } else
- return(success = 0);
- }
- #endif /* OS2 */
- #ifdef CK_APC
- case XYTAPC:
- if ((y = cmkey(apctab,3,"application program command execution","",
- xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- if (apcactive == APC_LOCAL ||
- (apcactive == APC_REMOTE && apcstatus != APC_UNCH))
- return(success = 0);
- apcstatus = y;
- return(success = 1);
- #ifdef CK_AUTODL
- case XYTAUTODL: /* AUTODOWNLOAD */
- #ifndef OS2
- x = seton(&autodl); /* For C-Kermit: ON, OFF, AUTO */
- if (x > 0)
- success = 1;
- return(x);
- #else /* OS2 */
- if ((y = cmkey(adltab,nadltab,"Auto-download options","",
- xxstring)) < 0)
- return(y);
- switch (y) {
- case TAD_ON:
- case TAD_OFF:
- if ((x = cmcfm()) < 0)
- return(x);
- autodl = y;
- break;
- case TAD_K:
- if ((y = cmkey(adlxtab,nadlxtab,"","", xxstring)) < 0)
- return(y);
- switch (y) {
- case TAD_X_C0:
- if ((y = cmkey(adlc0tab,nadlc0tab,"",
- "processed-by-emulator",xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- adl_kc0 = y;
- break;
- case TAD_X_DETECT:
- if ((y = cmkey(adldtab,nadldtab,"","packet",xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- adl_kmode = y;
- break;
- case TAD_X_STR:
- if ((y = cmtxt("Kermit start string","KERMIT READY TO SEND...",
- &s,xxstring)) < 0)
- return(y);
- free(adl_kstr);
- adl_kstr = strdup(s);
- break;
- }
- break;
- case TAD_Z:
- if ((y = cmkey(adlxtab,nadlxtab,"","",xxstring)) < 0)
- return(y);
- switch (y) {
- case TAD_X_C0:
- if ((y = cmkey(adlc0tab,nadlc0tab,"",
- "processed-by-emulator",xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- adl_zc0 = y;
- break;
- case TAD_X_DETECT:
- if ((y = cmkey(adldtab,nadldtab,"","packet",xxstring)) < 0)
- return(y);
- if ((x = cmcfm()) < 0)
- return(x);
- adl_zmode = y;
- break;
- case TAD_X_STR:
- if ((y = cmtxt("","rz\{13}",&s,xxstring)) < 0)
- return(y);
- free(adl_zstr);
- adl_zstr = strdup(s);
- break;
- }
- break;
- }
- return(success = 1);
- #endif /* OS2 */
- #endif /* CK_AUTODL */
- #endif /* CK_APC */
- #ifdef OS2
- case XYTBEL:
- return(success = setbell());
- case XYTMBEL: /* MARGIN-BELL */
- if ((y = cmkey(onoff,2,"","on",xxstring)) < 0) return(y);
- if (y) { /* ON */
- if ((z = cmnum("Column at which to set margin bell",
- "72",10,&x,xxstring)) < 0)
- return(z);
- }
- if ((z = cmcfm()) < 0) return(z);
- marginbell = y;
- marginbellcol = x;
- return(success = 1);
- case XYTIDLE: /* IDLE-SEND */
- if ((z = cmnum("seconds of idle time to wait, or 0 to disable",
- "0",10,&x,xxstring)) < 0)
- return(z);
- if ((y = cmtxt("string to send, may contain kverbs and variables",
- "\v(newline)",&s,xxstring)) < 0)
- return(y);
- tt_idlesnd_tmo = x;
- if (tt_idlesnd_str) {
- free(tt_idlesnd_str);
- tt_idlesnd_str = NULL;
- }
- s = brstrip(s);
- tt_idlesnd_str = strdup(s);
- puterror(VTERM);
- return(success = 1);
- #endif /* OS2 */
- case XYTDEB: /* TERMINAL DEBUG */
- x = debses; /* What it was before */
- y = seton(&debses); /* Go parse ON or OFF */
- #ifdef OS2
- if (y > 0) /* Command succeeded? */
- if ((x != 0) && (debses == 0)) /* It was on and we turned it off? */
- os2debugoff(); /* Fix OS/2 coloration */
- #endif /* OS2 */
- return(y);
- #ifdef OS2
- case XYTASCRL: /* SET TERMINAL AUTOSCROLL */
- y = seton(&autoscroll);
- return(y);
- case XYTAPAGE: /* SET TERMINAL AUTOPAGE */
- y = seton(&wy_autopage);
- return(y);
- case XYTROL: /* SET TERMINAL ROLL */
- if ((y = cmkey(rolltab,nroll,"scrollback mode","insert",xxstring))<0)
- return(y);
- if ((x = cmcfm()) < 0) return(x);
- tt_roll[VTERM] = y;
- return(success = 1);
- case XYTCTS: /* SET TERMINAL TRANSMIT-TIMEOUT */
- y = cmnum("Maximum seconds to allow CTS off during CONNECT",
- "5",10,&x,xxstring);
- return(setnum(&tt_ctstmo,x,y,10000));
- case XYTCPG: { /* SET TERMINAL CODE-PAGE */
- int i;
- int cp = -1;
- y = cmnum("PC code page to use during terminal emulation",
- "850",10,&x,xxstring);
- if ((x = setnum(&cp,x,y,11000)) < 0) return(x);
- if (os2setcp(cp) != 1) {
- #ifdef NT
- if (isWin95())
- printf(
- "Sorry, Windows 95 does not support code page switchingn");
- else
- #endif /* NT */
- printf(
- "Sorry, %d is not a valid code page for this system.n",cp);
- return(-9);
- }
- /* Force the terminal character-sets conversions to be updated */
- for ( i = 0; i < 4; i++ )
- G[i].init = TRUE;
- return(1);
- }
- case XYTPAC: /* SET TERMINAL OUTPUT-PACING */
- y = cmnum(
- "Pause between sending each character during CONNECT, milliseconds",
- "-1",10,&x,xxstring);
- return(setnum(&tt_pacing,x,y,10000));
- #ifdef OS2MOUSE
- case XYTMOU: { /* SET TERMINAL MOUSE */
- int old_mou = tt_mouse;
- if ((x = seton(&tt_mouse)) < 0)
- return(x);
- if (tt_mouse != old_mou)
- if (tt_mouse)
- os2_mouseon();
- else
- os2_mouseoff();
- return(1);
- }
- #endif /* OS2MOUSE */
- #endif /* OS2 */
- case XYTWID: {
- if ((y = cmnum(
- #ifdef OS2
- "number of columns in display window during CONNECT",
- #else
- "number of columns on your screen",
- #endif /* OS2 */
- "80",10,&x,xxstring)) < 0)
- return(y);
- if ((y = cmcfm()) < 0) return(y);
- #ifdef OS2
- if (x % 2) {
- printf("n?The width must be an even valuen.");
- return(success = 0);
- }
- if ( IsOS2FullScreen() ) {
- if ( x != 40 && x != 80 && x != 132 ) {
- printf("n?The width must be 40, 80,");
- #ifdef NT
- printf(" or 132 under Windows 95.n.");
- #else /* NT */
- printf(" or 132 in a Full Screen session.n.");
- #endif /* NT */
- return(success = 0);
- }
- } else {
- if ( !IsWARPed() && x != 80 ) {
- printf("n?OS/2 version is pre-WARP: the width must equal ");
- printf("80 in a Windowed Sessionn.");
- return(success = 0);
- }
- if (x < 20 || x > MAXTERMCOL ) {
- printf(
- "n?The width must be between 20 and %dn.",MAXTERMCOL);
- return(success = 0);