| #include "ckcsym.h" |
| |
| /* C K U U S 7 -- "User Interface" for C-Kermit, part 7 */ |
| |
| /* |
| Authors: |
| Frank da Cruz <fdc@columbia.edu>, |
| The Kermit Project, Columbia University, New York City |
| Jeffrey E Altman <jaltman@secure-endpoints.com> |
| Secure Endpoints Inc., New York City |
| |
| Copyright (C) 1985, 2004, |
| Trustees of Columbia University in the City of New York. |
| All rights reserved. See the C-Kermit COPYING.TXT file or the |
| copyright text in the ckcmai.c module for disclaimer and permissions. |
| */ |
| |
| /* |
| This file created from parts of ckuus3.c, which became too big for |
| Mark Williams Coherent compiler to handle. |
| */ |
| |
| /* |
| Definitions here supersede those from system include files. |
| */ |
| #include "ckcdeb.h" /* Debugging & compiler things */ |
| #include "ckcasc.h" /* ASCII character symbols */ |
| #include "ckcker.h" /* Kermit application definitions */ |
| #include "ckcxla.h" /* Character set translation */ |
| #include "ckcnet.h" /* Network symbols */ |
| #include "ckuusr.h" /* User interface symbols */ |
| #include "ckucmd.h" |
| #include "ckclib.h" |
| |
| #ifdef VMS |
| #ifndef TCPSOCKET |
| #include <errno.h> |
| #endif /* TCPSOCKET */ |
| #endif /* VMS */ |
| |
| #ifdef OS2 |
| #ifndef NT |
| #define INCL_NOPM |
| #define INCL_VIO /* Needed for ckocon.h */ |
| #define INCL_DOSMODULEMGR |
| #include <os2.h> |
| #undef COMMENT |
| #else /* NT */ |
| #define APIRET ULONG |
| #include <windows.h> |
| #include <tapi.h> |
| #include "cknwin.h" |
| #include "ckntap.h" |
| #endif /* NT */ |
| #include "ckowin.h" |
| #include "ckocon.h" |
| #include "ckodir.h" |
| #ifdef OS2MOUSE |
| #include "ckokey.h" |
| #endif /* OS2MOUSE */ |
| #ifdef KUI |
| #include "ikui.h" |
| #endif /* KUI */ |
| #ifdef putchar |
| #undef putchar |
| #endif /* putchar */ |
| #define putchar(x) conoc(x) |
| extern int mskkeys; |
| #endif /* OS2 */ |
| |
| #ifdef CK_AUTHENTICATION |
| #include "ckuath.h" |
| #endif /* CK_AUTHENTICATION */ |
| #ifdef CK_SSL |
| #include "ck_ssl.h" |
| #endif /* CK_SSL */ |
| #ifdef SSHBUILTIN |
| #include "ckossh.h" |
| #endif /* SSHBUILTIN */ |
| #ifdef STRATUS /* Stratus Computer, Inc. VOS */ |
| #ifdef putchar |
| #undef putchar |
| #endif /* putchar */ |
| #define putchar(x) conoc(x) |
| #ifdef getchar |
| #undef getchar |
| #endif /* getchar */ |
| #define getchar(x) coninc(0) |
| #endif /* STRATUS */ |
| |
| char * slmsg = NULL; |
| |
| static int x, y = 0, z; |
| static char *s; |
| |
| extern CHAR feol; |
| extern int g_matchdot, hints, xcmdsrc, rcdactive; |
| |
| extern char * k_info_dir; |
| |
| #ifndef 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, * g_sfilter; |
| extern char * rcvfilter, * g_rfilter; |
| #endif /* PIPESEND */ |
| |
| extern char * snd_move; |
| extern char * snd_rename; |
| extern char * g_snd_move; |
| extern char * g_snd_rename; |
| extern char * rcv_move; |
| extern char * rcv_rename; |
| extern char * g_rcv_move; |
| extern char * g_rcv_rename; |
| |
| #ifdef 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; |
| |
| extern int atfrmi, atfrmo; |
| #ifdef STRATUS |
| extern int 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 */ |
| |
| #ifdef SSHBUILTIN |
| int sl_ssh_xfw = 0; |
| int sl_ssh_xfw_saved = 0; |
| int sl_ssh_ver = 0; |
| int sl_ssh_ver_saved = 0; |
| #endif /* SSHBUILTIN */ |
| |
| #ifdef CK_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 */ |
| |
| #ifdef TNCODE |
| extern int tn_wait_flg; |
| #endif /* TNCODE */ |
| |
| VOID |
| slrestor() { |
| #ifdef CK_AUTHENTICATION |
| int x; |
| if (sl_auth_saved) { |
| for (x = 0; x < AUTHTYPLSTSZ; x++) |
| auth_type_user[x] = sl_auth_type_user[x]; |
| sl_auth_saved = 0; |
| } |
| if (sl_topt_a_s_saved) { |
| TELOPT_DEF_S_U_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_su; |
| sl_topt_a_s_saved = 0; |
| } |
| if (sl_topt_a_c_saved) { |
| TELOPT_DEF_C_ME_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_cm; |
| sl_topt_a_c_saved = 0; |
| } |
| #endif /* CK_AUTHENTICATION */ |
| #ifdef CK_ENCRYPTION |
| if (sl_cx_saved) { |
| cx_type = sl_cx_type; |
| sl_cx_saved = 0; |
| } |
| if (sl_topt_e_s_saved) { |
| TELOPT_DEF_S_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_su; |
| TELOPT_DEF_S_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_sm; |
| sl_topt_e_s_saved = 0; |
| } |
| if (sl_topt_e_c_saved) { |
| TELOPT_DEF_C_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cu; |
| TELOPT_DEF_C_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cm; |
| sl_topt_e_c_saved = 0; |
| } |
| #endif /* CK_ENCRYPTION */ |
| if (sl_uid_saved) { |
| ckstrncpy(uidbuf,sl_uidbuf,UIDBUFLEN); |
| sl_uid_saved = 0; |
| } |
| #ifdef TNCODE |
| if (sl_tn_saved) { |
| tn_wait_flg = sl_tn_wait; |
| sl_tn_saved = 0; |
| } |
| #endif /* TNCODE */ |
| #ifdef SSHBUILTIN |
| if (sl_ssh_xfw_saved) { |
| ssh_xfw = sl_ssh_xfw; |
| sl_ssh_xfw_saved = 0; |
| } |
| if (sl_ssh_ver_saved) { |
| ssh_ver = sl_ssh_ver; |
| sl_ssh_ver_saved = 0; |
| } |
| #endif /* SSHBUILTIN */ |
| } |
| |
| int oldplex = -1; /* Duplex holder around network */ |
| |
| #ifndef NOICP |
| #ifdef LOCUS |
| extern int locus, autolocus; |
| #endif /* LOCUS */ |
| #ifndef NODIAL |
| extern int dialsta; |
| #endif /* NODIAL */ |
| |
| /* Note: gcc -Wall wants braces around each keyword table entry. */ |
| |
| static struct keytab psltab[] = { /* SET LINE/PORT command options */ |
| { "/connect", SL_CNX, 0 }, |
| #ifdef OS2ORVMS |
| { "/noshare", SL_NSH, 0 }, |
| #endif /* OS2ORVMS */ |
| { "/server", SL_SRV, 0 }, |
| #ifdef OS2ORVMS |
| { "/share", SL_SHR, 0 }, |
| #endif /* OS2ORVMS */ |
| { "", 0, 0 } |
| }; |
| static int npsltab = sizeof(psltab)/sizeof(struct keytab) - 1; |
| |
| #ifdef NETCONN |
| static struct keytab shtab[] = { /* SET HOST command options */ |
| #ifdef NETCMD |
| /* (COMMAND is also a network type) */ |
| { "/command", SL_CMD, CM_INV }, |
| #endif /* NETCMD */ |
| { "/connect", SL_CNX, 0 }, |
| { "/network-type", SL_NET, CM_ARG }, |
| { "/nowait", SL_NOWAIT, 0 }, |
| #ifndef NOSPL |
| #ifdef CK_AUTHENTICATION |
| { "/password", SL_PSW, CM_ARG }, |
| #endif /* CK_AUTHENTICATION */ |
| #endif /* NOSPL */ |
| #ifdef NETCMD |
| { "/pipe", SL_CMD, 0 }, |
| #endif /* NETCMD */ |
| #ifdef NETPTY |
| { "/pty", SL_PTY, 0 }, |
| #endif /* NETPTY */ |
| { "/server", SL_SRV, 0 }, |
| { "/timeout", SL_TMO, CM_ARG }, |
| { "/userid", SL_UID, CM_ARG }, |
| { "/wait", SL_WAIT, 0 }, |
| { "", 0, 0 } |
| }; |
| static int nshtab = sizeof(shtab)/sizeof(struct keytab) - 1; |
| |
| static struct keytab shteltab[] = { /* TELNET command options */ |
| #ifdef CK_AUTHENTICATION |
| { "/auth", SL_AUTH, CM_ARG }, |
| #endif /* CK_AUTHENTICATION */ |
| #ifdef CK_ENCRYPTION |
| { "/encrypt", SL_ENC, CM_ARG }, |
| #endif /* CK_ENCRYPTION */ |
| { "/nowait", SL_NOWAIT, 0 }, |
| #ifndef NOSPL |
| #ifdef CK_AUTHENTICATION |
| { "/password", SL_PSW, CM_ARG }, |
| #endif /* CK_AUTHENTICATION */ |
| #endif /* NOSPL */ |
| { "/timeout", SL_TMO, CM_ARG }, |
| { "/userid", SL_UID, CM_ARG }, |
| { "/wait", SL_WAIT, 0 }, |
| { "", 0 ,0 } |
| }; |
| static int nshteltab = sizeof(shteltab)/sizeof(struct keytab) - 1; |
| |
| #ifdef 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 */ |
| #endif /* NETCONN */ |
| |
| _PROTOTYP(int remtxt, (char **) ); |
| _PROTOTYP(VOID rmsg, (void) ); |
| _PROTOTYP(static int remcfm, (void) ); |
| |
| extern int nopush; |
| |
| int mdmsav = -1; /* Save modem type around network */ |
| extern int isguest; /* Global flag for anonymous login */ |
| |
| extern xx_strp xxstring; |
| |
| extern int success, binary, b_save, ckwarn, msgflg, quiet, cmask, pflag, local, |
| nettype, escape, mdmtyp, duplex, dfloc, network, cdtimo, autoflow, tnlm, |
| sosi, tlevel, lf_opts, backgrd, flow, debses, parity, ttnproto, ckxech, |
| x_ifnum, cmflgs, haveline, cxtype, cxflow[], maclvl; |
| |
| #ifdef DCMDBUF |
| extern struct cmdptr *cmdstk; /* The command stack itself */ |
| #else |
| extern struct cmdptr cmdstk[]; /* The command stack itself */ |
| #endif /* DCMDBUF */ |
| extern FILE * tfile[]; |
| extern char * macp[]; |
| |
| extern char psave[]; /* For saving & restoring prompt */ |
| extern int sprmlen, rprmlen; |
| |
| #ifdef 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 */ |
| { "user", 3, 0 }, |
| { "transparent", 3, CM_INV } /* not really transparent */ |
| }; |
| 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 int tt_url_hilite, tt_url_hilite_attr; |
| 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[]; |
| |
| #ifdef CK_TAPI |
| int tttapi = 0; /* is Line TAPI? */ |
| struct keytab * tapilinetab = NULL; |
| struct keytab * _tapilinetab = NULL; |
| int ntapiline = 0; |
| #endif /* CK_TAPI */ |
| |
| #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 |
| extern bool ttshare; |
| #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 */ |
| #ifdef KRB5_U2U |
| { "/k5user2user", NP_K5U2U, 0 }, |
| #endif /* KRB5_U2U */ |
| #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 COMMENT |
| #ifndef NOSETKEY |
| extern KEY *keymap; |
| #ifndef OS2 |
| #define mapkey(x) keymap[x] |
| #endif /* OS2 */ |
| extern MACRO *macrotab; |
| #ifndef NOKVERBS |
| extern struct keytab kverbs[]; |
| extern int nkverbs; |
| #endif /* NOKVERBS */ |
| #endif /* NOSETKEY */ |
| #else |
| #ifndef NOSETKEY |
| extern KEY *keymap; |
| extern MACRO *macrotab; |
| #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; |
| |
| #ifndef NOCSETS |
| static struct keytab fdfltab[] = { |
| { "7bit-character-set", 7, 0 }, |
| { "8bit-character-set", 8, 0 } |
| }; |
| static int nfdflt = (sizeof(fdfltab) / sizeof(struct keytab)); |
| #endif /* NOCSETS */ |
| |
| /* 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 }, |
| { "default", XYF_DFLT, 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 */ |
| #ifndef NOXFER |
| { "fastlookups", 9997, CM_INV }, |
| { "incomplete", XYFILI, 0 }, |
| #ifndef datageneral |
| { "inspection", XYF_INSP, CM_INV }, |
| #endif /* datageneral */ |
| #ifdef CK_LABELED |
| { "label", XYFILL, 0 }, |
| #endif /* CK_LABELED */ |
| |
| #ifdef UNIX |
| #ifdef DYNAMIC |
| { "listsize", XYF_LSIZ, 0 }, |
| #endif /* DYNAMIC */ |
| #endif /* UNIX */ |
| |
| { "names", XYFILN, 0 }, |
| #ifdef UNIX |
| { "output", XYFILH, 0 }, |
| #endif /* UNIX */ |
| #ifdef PATTERNS |
| { "patterns", XYFIPA, 0 }, |
| #endif /* PATTERNS */ |
| #ifdef COMMENT /* Not implemented (but see CHMOD) */ |
| { "permissions", XYF_PRM, CM_INV }, |
| { "protection", XYF_PRM, 0 }, |
| #endif /* COMMENt */ |
| #ifdef VMS |
| { "record-length", XYFILR, 0 }, |
| #endif /* VMS */ |
| #ifndef datageneral |
| { "scan", XYF_INSP, 0 }, |
| #endif /* datageneral */ |
| |
| #ifdef UNIX |
| #ifdef DYNAMIC |
| { "stringspace", XYF_SSPA, 0 }, |
| #endif /* DYNAMIC */ |
| #endif /* UNIX */ |
| |
| #ifdef PATTERNS |
| { "t", XYFILT, CM_INV|CM_ABR }, |
| { "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 */ |
| |
| 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, dcset7, dcset8; |
| #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 */ |
| { "rename", XYFX_R, 0 }, /* rename the incoming file */ |
| #ifndef MAC /* This crashes Mac Kermit. */ |
| { "update", XYFX_U, 0 }, /* replace if newer */ |
| #endif /* MAC */ |
| { "", 0, 0 } |
| }; |
| int ncolx = (sizeof(colxtab) / sizeof(struct keytab)) - 1; |
| |
| 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 |
| { "character-set", XYTCS, 0 }, |
| #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 }, |
| #else |
| #ifdef KUI |
| { "font", XYTFON, 0 }, |
| #endif /* KUI */ |
| #endif /* PCFONTS */ |
| #endif /* OS2 */ |
| { "height", XYTHIG, 0 }, |
| #ifdef CKTIDLE |
| { "idle-action", XYTIACT, 0 }, |
| { "idle-limit", XYTITMO, CM_INV }, |
| { "idle-send", XYTIDLE, CM_INV }, |
| { "idle-timeout", XYTITMO, 0 }, |
| #endif /* CKTIDLE */ |
| #ifdef OS2 |
| #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 |
| #ifndef KUI |
| { "line-spacing", XYTLSP, CM_INV }, |
| { "local-character-set", XYTLCS, 0 }, |
| #else |
| { "line-spacing", XYTLSP, 0 }, |
| { "local-character-set", XYTLCS, CM_INV }, |
| #endif /* KUI */ |
| #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 }, |
| { "tra", XYTCTS, CM_INV|CM_ABR }, |
| { "transmit-timeout", XYTCTS, 0 }, |
| #endif /* OS2 */ |
| |
| #ifdef OS2ORUNIX |
| { "transparent-print", XYTPRN, CM_INV }, |
| #endif /* OS2ORUNIX */ |
| |
| #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 |
| #ifdef CKOUNI |
| { "unicode", XYTUNI, CM_INV }, |
| #endif /* CKOUNI */ |
| #endif /* UNICODE */ |
| #endif /* NOCSETS */ |
| #ifdef OS2 |
| { "unix-mode", XYTUNX, CM_INV }, |
| { "url-highlight", XYTURLHI, 0 }, |
| #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 curontab[] = { /* SET TERM CURSOR */ |
| #ifdef KUI |
| { "noblink", 2, 0 }, |
| #else |
| { "noblink", 2, CM_INV }, |
| #endif /* KUI */ |
| { "off", 0, 0 }, |
| { "on", 1, 0 } |
| }; |
| int ncuron = (sizeof(curontab) / sizeof(struct keytab)); |
| |
| struct keytab rolltab[] = { /* Set TERM Roll Options */ |
| { "insert", TTR_INSERT, 0 }, |
| { "keystrokes",TTR_KEYS, 0 }, |
| { "off", TTR_OVER, CM_INV }, |
| { "on", TTR_INSERT, CM_INV }, |
| { "overwrite", TTR_OVER, 0 } |
| }; |
| int nroll = (sizeof(rolltab) / sizeof(struct keytab)); |
| |
| struct keytab rollkeytab[] = { /* Set TERM ROLL KEYSTROKES */ |
| { "ignore", TTRK_IGN, 0 }, |
| { "restore-and-send", TTRK_RST, 0 }, |
| { "send", TTRK_SND, 0 } |
| }; |
| int nrollkey = (sizeof(rollkeytab) / 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 } |
| }; |
| int ngraphset = (sizeof(graphsettab) / sizeof(struct keytab)); |
| #endif /* OS2 */ |
| |
| struct keytab adltab[] = { /* Autodownload Options */ |
| { "ask", TAD_ASK, 0 }, |
| { "error", TAD_ERR, 0 }, |
| #ifdef OS2 |
| { "kermit", TAD_K, 0 }, |
| #endif /* OS2 */ |
| { "off", TAD_OFF, 0 }, |
| { "on", TAD_ON, 0 }, |
| #ifdef OS2 |
| { "zmodem", TAD_Z, 0 }, |
| #endif /* OS2 */ |
| { "", 0, 0 } |
| }; |
| int nadltab = (sizeof(adltab) / sizeof(struct keytab)) - 1; |
| |
| struct keytab adlerrtab[] = { /* Autodownload Error Options */ |
| { "continue", 0, 0 }, |
| { "go", 0, CM_INV }, |
| { "stop", 1, 0 } |
| }; |
| int nadlerrtab = (sizeof(adlerrtab) / sizeof(struct keytab)); |
| |
| #ifdef OS2 |
| 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)); |
| |
| #ifndef NOCSETS |
| 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 /* NOCSETS */ |
| #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 */ |
| { "no-input", APC_ON|APC_NOINP,0 }, |
| { "off", APC_OFF, 0 }, |
| { "on", APC_ON, 0 }, |
| { "unchecked", APC_ON|APC_UNCH, 0 }, |
| { "unchecked-no-input", APC_ON|APC_NOINP|APC_UNCH, 0 } |
| }; |
| int napctab = (sizeof(apctab) / sizeof(struct keytab)); |
| #endif /* CK_APC */ |
| #endif /* NOLOCAL */ |
| |
| extern int autodl, adl_err, adl_ask; |
| |
| 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 CKTIDLE |
| int tt_idlesnd_tmo = 0; /* Idle Send Timeout, disabled */ |
| char * tt_idlesnd_str = NULL; /* Idle Send String, none */ |
| char * tt_idlestr = NULL; |
| extern int tt_idleact, tt_idlelimit; |
| #endif /* CKTIDLE */ |
| |
| #ifdef OS2 |
| #ifndef NOLOCAL |
| /* |
| 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)) - 1; |
| |
| #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_cursor_blink = 1; /* Terminal Cursor Blink */ |
| 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_rkeys[VNUM] = {1,1,1,1}; /* Terminal roll keys (send) */ |
| int tt_pacing = 0; /* Terminal output-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; |
| #ifndef KUI |
| int tt_status[VNUM] = {1,1,0,0}; /* Terminal status line displayed */ |
| int tt_status_usr[VNUM] = {1,1,0,0}; |
| #else /* KUI */ |
| extern CKFLOAT floatval; |
| CKFLOAT tt_linespacing[VNUM] = {1.0,1.0,1.0,1.0}; |
| #ifdef K95G |
| int tt_status[VNUM] = {1,1,0,0}; /* Terminal status line displayed */ |
| int tt_status_usr[VNUM] = {1,1,0,0}; |
| #else /* K95G */ |
| int tt_status[VNUM] = {0,0,0,0}; /* Terminal status line displayed */ |
| int tt_status_usr[VNUM] = {0,0,0,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 */ |
| |
| extern unsigned char colornormal, colorselect, |
| colorunderline, colorstatus, colorhelp, colorborder, |
| colorgraphic, colordebug, colorreverse, coloritalic; |
| |
| extern int trueblink, trueunderline, truereverse, trueitalic, truedim; |
| |
| 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 TTCOLITA 9 |
| #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 */ |
| { "italic", TTCOLITA, 0 }, /* Italic Color */ |
| { "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 TTATTITA 8 |
| #define TTATTDONE 9 |
| |
| struct keytab ttyattrtab[] = { |
| { "blink", TTATTBLI, 0 }, |
| { "dim", TTATTDIM, 0 }, |
| { "italic", TTATTITA, 0 }, |
| { "protected", TTATTPRO, 0 }, |
| { "reverse", TTATTREV, 0 }, |
| { "underline", TTATTUND, 0 } |
| }; |
| int nattrib = (sizeof(ttyattrtab) / sizeof(struct keytab)); |
| |
| struct keytab ttyprotab[] = { |
| { "blink", TTATTBLI, 0 }, |
| { "bold", TTATTBLD, 0 }, |
| { "dim", TTATTDIM, 0 }, |
| { "done", TTATTDONE, CM_INV }, |
| { "invisible", TTATTINV, 0 }, |
| { "italic", TTATTITA, 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[] = { |
| { "aaa", TT_AAA, CM_INV }, /* AnnArbor */ |
| { "adm3a", TT_ADM3A, 0 }, /* LSI ADM-3A */ |
| { "adm5", TT_ADM5, 0 }, /* LSI ADM-5 */ |
| { "aixterm", TT_AIXTERM, 0 }, /* IBM AIXterm */ |
| { "annarbor", TT_AAA, 0 }, /* AnnArbor */ |
| { "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, 0 }, /* 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 */ |
| { "sun", TT_SUN, 0 }, /* SUN Console */ |
| /* |
| 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[] = { |
| { "aaa", TT_AAA, CM_INV }, /* AnnArbor */ |
| { "adm3a", TT_ADM3A, 0 }, /* LSI ADM-3A */ |
| { "adm5", TT_ADM5, 0 }, /* LSI ADM-5 */ |
| { "aixterm", TT_AIXTERM, 0 }, /* IBM AIXterm */ |
| { "annarbor", TT_AAA, 0 }, /* AnnArbor */ |
| { "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 (DR2) */ |
| { "d200", TT_DG200, CM_INV|CM_ABR }, /* DG DASHER 200 */ |
| { "d210", TT_DG210, CM_INV|CM_ABR }, /* DG DASHER 210 */ |
| { "d217", TT_DG217, CM_INV|CM_ABR }, /* DG DASHER 217 */ |
| { "dg200", TT_DG200, 0 }, /* DG DASHER 200 */ |
| { "dg210", TT_DG210, 0 }, /* DG DASHER 210 */ |
| { "dg217", TT_DG217, 0 }, /* DG 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 Term */ |
| { "hp2621a", TT_HP2621, 0 }, /* HP 2621A */ |
| { "hpterm", TT_HPTERM, 0 }, /* HP TERM */ |
| { "hz1500", TT_HZL1500, 0 }, /* Hazeltine 1500 */ |
| { "ibm3151", TT_IBM31, 0 }, /* 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 */ |
| { "sun", TT_SUN, 0 }, /* SUN Console */ |
| #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)); |
| |
| #ifndef NOSETKEY |
| struct keytab kbmodtab[] = { |
| { "emacs", KBM_EM, 0 }, |
| { "english", KBM_EN, CM_INV }, |
| { "hebrew", KBM_HE, 0 }, |
| { "normal", KBM_EN, 0 }, |
| { "none", KBM_EN, CM_INV }, |
| { "russian", KBM_RU, 0 }, |
| { "wp", KBM_WP, 0 } |
| }; |
| int nkbmodtab = (sizeof(kbmodtab) / sizeof(struct keytab)); |
| #endif /* NOSETKEY */ |
| #endif /* NOLOCAL */ |
| |
| int tt_inpacing = 0; /* input-pacing (none) */ |
| |
| 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 }, |
| { "horizontal-scan-line-substitutions", XYWHSL, 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 }, |
| { "debug", XYM_DEBUG, 0 } |
| }; |
| int nmtab = (sizeof(mousetab)/sizeof(struct keytab)); |
| |
| struct keytab mousebuttontab[] = { /* event button */ |
| { "1", XYM_B1, 0 }, |
| { "2", XYM_B2, 0 }, |
| { "3", XYM_B3, 0 }, |
| { "one", XYM_B1, CM_INV }, |
| { "three", XYM_B3, CM_INV }, |
| { "two", XYM_B2, CM_INV } |
| }; |
| 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 */ |
| #ifdef KUI |
| { "gui", XYFD_G, 0 }, /* GUI */ |
| #endif /* KUI */ |
| { "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 */ |
| { "", 0, 0 } |
| }; |
| int nfdtab = (sizeof(fdtab) / sizeof(struct keytab)) - 1; |
| |
| 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 */ |
| { "i-packets", 993, 0 }, |
| { "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 }, |
| #ifdef CK_PERMS |
| { "permissions", 994, 0}, /* 206 */ |
| #endif /* CK_PERMS */ |
| { "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 */ |
| { "match", XYMATCH,0 }, |
| { "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 }, |
| { "format", AT_RECF, CM_INV }, |
| { "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 */ |
| { "record-format", AT_RECF, 0 }, |
| { "system-id", AT_SYSI, 0 }, |
| { "type", AT_FTYP, 0 } |
| }; |
| int natr = (sizeof(attrtab) / sizeof(struct keytab)); /* how many attributes */ |
| |
| #ifdef CKTIDLE |
| struct keytab idlacts[] = { |
| { "exit", IDLE_EXIT, 0 }, |
| { "hangup", IDLE_HANG, 0 }, |
| { "output", IDLE_OUT, 0 }, |
| { "return", IDLE_RET, 0 }, |
| #ifdef TNCODE |
| { "telnet-nop", IDLE_TNOP, 0 }, |
| { "telnet-ayt", IDLE_TAYT, 0 }, |
| #endif /* TNCODE */ |
| { "", 0, 0 } |
| }; |
| int nidlacts = (sizeof(idlacts) / sizeof(struct keytab)) - 1; |
| #endif /* CKTIDLE */ |
| |
| #ifndef NOSPL |
| extern int indef, inecho, insilence, inbufsize, inautodl, inintr; |
| #ifdef CKFLOAT |
| extern CKFLOAT inscale; |
| #endif /* CKFLOAT */ |
| 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 */ |
| { "scale-factor", IN_SCA, 0 }, |
| { "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 */ |
| { "", 0, 0 } |
| }; |
| int ntvctab = (sizeof(tvctab) / sizeof(struct keytab)) - 1; |
| |
| 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)); |
| |
| #ifdef PCFONTS |
| /* This definition of the term_font[] table is only for */ |
| /* the OS/2 Full Screen Session and is not used on Windows */ |
| struct keytab term_font[] = { /* 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(term_font) / sizeof(struct keytab)); |
| int tt_font = TTF_ROM; /* Terminal screen font */ |
| #else /* PCFONTS */ |
| #ifdef NT |
| #ifdef KUI |
| struct keytab * term_font = NULL; |
| struct keytab * _term_font = NULL; |
| char * tt_facename = NULL; |
| int ntermfont = 0; |
| int tt_font = 0; |
| int tt_font_size = 0; |
| #endif /* KUI */ |
| #endif /* NT */ |
| #endif /* PCFONTS */ |
| |
| 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 |
| #ifdef KUI |
| int win95lucida = 0; |
| int win95hsl = 1; |
| #else /* KUI */ |
| int win95lucida = 1; |
| int win95hsl = 1; |
| #endif /* KUI */ |
| #else /* NT */ |
| int win95lucida = 0; |
| int win95hsl = 1; |
| #endif /* NT */ |
| #ifdef NT |
| int win95altgr = 0; |
| 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 required\n"); |
| return(-9); |
| } |
| if (y == -2) { |
| printf("%s?Not a number: %s\n",cmflgs == 1 ? "" : "\n", atxbuf); |
| return(-9); |
| } |
| if (y < 0) return(y); |
| if (max > -1 && x > max) { |
| printf("?Sorry, %d is the maximum\n",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 */ |
| } |
| /* Real control character or literal 8-bit 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]) { /* Literal character? */ |
| c &= 0xff; |
| if (((c > 31) && (c < 127)) || (c > 255)) { |
| printf("\n?%d: Out of range - must be 0-31 or 127-255\n",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 - %s\n", atmbuf); |
| return(-9); |
| } |
| } else { /* Something illegal was typed */ |
| printf("?Invalid - %s\n", atmbuf); |
| return(-9); |
| } |
| } |
| if (((x > 31) && (x < 127)) || (x > 255)) { /* They typed a number */ |
| printf("\n?%d: Out of range - must be 0-31 or 127-255\n",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 arguments\n"); |
| 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: %s\n",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: %d\n",cmresult.fcode); |
| return(-9); |
| } |
| if (confirmed) { |
| printf("?Array name required\n"); |
| return(-9); |
| } |
| ckmakmsg(tmpbuf,TMPBUFSIZ, |
| "Second array to sort according to ",s,NULL,NULL); |
| if ((x = cmfld(tmpbuf,"",&p,NULL)) < 0) |
| if (x != -3) |
| return(x); |
| tmpbuf[0] = NUL; |
| ckstrncpy(tmpbuf,p,TMPBUFSIZ); |
| p = tmpbuf; |
| if ((x = cmcfm()) < 0) /* Get confirmation */ |
| return(x); |
| |
| x = arraybounds(s,&lo,&hi); /* Get array index & bounds */ |
| if (x < 0) { /* Check */ |
| printf("?Bad array name: %s\n",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: %s\n", 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 %d\n", |
| 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:%d\n",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: %s\n", 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: %s\n", p); |
| return(-9); |
| } |
| if (a_dim[y] < range[1]) { |
| printf("?Array %s smaller than %s\n", p, s); |
| return(-9); |
| } |
| xp += range[0]; /* Set base to same as 1st array */ |
| } |
| } |
| 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++; |
| ckmakmsg(tmpbuf,TMPBUFSIZ,"/KEEP:",ckitoa(pu_keep),NULL,NULL); |
| 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 argument\n"); |
| return(-9); |
| } |
| if (!getval && (cmgkwflgs() & CM_ARG)) { |
| printf("?This switch requires an argument\n"); |
| 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 %d\n", |
| 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 set\n"); |
| 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 |