| #ifdef SSHTEST |
| #define SSHBUILTIN |
| #endif /* SSHTEST */ |
| |
| #include "ckcsym.h" /* Symbol definitions */ |
| |
| /* C K U U S 3 -- "User Interface" for C-Kermit, part 3 */ |
| |
| /* |
| 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. |
| */ |
| |
| /* SET command (but much material has been split off into ckuus7.c). */ |
| |
| /* |
| Kermit-specific includes. |
| 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 */ |
| |
| char pwbuf[PWBUFL+1] = { NUL, NUL }; |
| int pwflg = 0; |
| int pwcrypt = 0; |
| |
| #ifndef NOICP |
| |
| #ifdef CK_AUTHENTICATION |
| #include "ckuath.h" |
| #endif /* CK_AUTHENTICATION */ |
| #ifdef CK_SSL |
| #include "ck_ssl.h" |
| #endif /* CK_SSL */ |
| #include "ckuusr.h" /* User interface symbols */ |
| #ifdef OS2 |
| #include "ckcuni.h" |
| #ifdef SSHBUILTIN |
| #include "ckossh.h" |
| #endif /* SSHBUILTIN */ |
| #ifdef CK_NETBIOS |
| #include <os2.h> |
| #ifdef COMMENT /* Would you believe */ |
| #undef COMMENT /* <os2.h> defines this ? */ |
| #endif /* COMMENT */ |
| #include "ckonbi.h" |
| extern UCHAR NetBiosAdapter; |
| #endif /* CK_NETBIOS */ |
| #include "ckocon.h" |
| #include "ckokey.h" |
| #ifndef NOTERM |
| extern unsigned char colorcmd; /* Command-screen colors */ |
| extern struct keytab ttyclrtab[]; |
| extern int nclrs; |
| extern int tt_cols[], tt_rows[], tt_szchng[], tt_status[]; |
| #endif /* NOTERM */ |
| _PROTOTYP(int setprty, (void)); |
| extern char startupdir[], exedir[]; |
| extern int tt_modechg; |
| #ifdef NT |
| #include <windows.h> |
| #include <tapi.h> |
| #include "ckntap.h" /* Microsoft TAPI */ |
| #endif /* NT */ |
| #endif /* OS2 */ |
| |
| #ifndef OS2 |
| extern char * exedir; |
| #endif /* OS2 */ |
| |
| #ifdef CK_RECALL |
| extern int cm_retry; |
| #endif /* CK_RECALL */ |
| |
| extern int cmdint; |
| extern int srvidl; |
| |
| #ifdef CKFLOAT |
| extern CKFLOAT floatval; /* (see isfloat()) */ |
| #endif /* CKFLOAT */ |
| |
| #ifndef NOPUSH |
| #ifndef NOFRILLS |
| #ifdef VMS |
| char editor[CKMAXPATH + 1] = "edit"; |
| #else |
| char editor[CKMAXPATH + 1] = { NUL, NUL }; |
| #endif /* VMS */ |
| char editopts[128] = { NUL, NUL }; |
| char editfile[CKMAXPATH + 1] = { NUL, NUL }; |
| #ifdef BROWSER |
| char browser[CKMAXPATH + 1] = { NUL, NUL }; |
| char browsopts[128] = { NUL, NUL }; |
| char browsurl[4096] = { NUL, NUL }; |
| #endif /* BROWSER */ |
| #endif /* NOFRILLS */ |
| #endif /* NOPUSH */ |
| |
| /* Variables */ |
| |
| int cmd_quoting = 1; |
| extern int hints, xcmdsrc; |
| |
| #ifdef CK_KERBEROS |
| char * k4pwprompt = NULL; /* Kerberos 4 password prompt */ |
| char * k4prprompt = NULL; /* Kerberos 4 principal prompt */ |
| char * k5pwprompt = NULL; /* Kerberos 5 password prompt */ |
| char * k5prprompt = NULL; /* Kerberos 5 principal prompt */ |
| #endif /* CK_KERBEROS */ |
| #ifdef CK_SRP |
| char * srppwprompt = NULL; |
| #endif /* CK_SRP */ |
| |
| extern char * ckprompt, * ikprompt; /* Default prompt */ |
| extern xx_strp xxstring; |
| |
| extern char * cdmsgfile[], * cdmsgstr; |
| |
| extern int |
| local, server, success, dest, sleepcan, inserver, flow, autoflow, binary, |
| parity, escape, what, turn, duplex, backgrd, hwparity, stopbits, turnch, |
| mdmtyp, network, quiet, nettype, carrier, debses, debtim, cdtimo, nlangs, |
| bgset, pflag, msgflg, cmdmsk, xsuspend, techo, pacing, xitwarn, xitsta, |
| outesc, cmd_cols, cmd_rows, ckxech, xaskmore, haveline, didsetlin, isguest, |
| mdmsav, clearrq, saveask; |
| |
| extern int reliable, setreliable, matchdot, matchfifo, dir_dots; |
| |
| #ifndef NOSERVER |
| extern int en_pri; |
| #endif /* NOSERVER */ |
| |
| #ifdef IKSDCONF |
| extern int iksdcf; |
| #endif /* IKSDCONF */ |
| #ifdef TCPSOCKET |
| extern int tn_exit; |
| #endif /* TCPSOCKET */ |
| #ifdef TNCODE |
| char * tn_pr_uid = NULL; |
| #endif /* TNCODE */ |
| extern int exitonclose; |
| |
| #ifndef NOKVERBS |
| extern int nkverbs; |
| extern struct keytab kverbs[]; |
| #endif /* NOKVERBS */ |
| |
| extern int ttnproto; /* Network protocol */ |
| |
| extern char *ccntab[]; /* Names of control chars */ |
| |
| #ifdef CK_APC |
| extern int apcactive, apcstatus; |
| #endif /* CK_APC */ |
| |
| #ifndef NOSCRIPT |
| extern int secho; /* Whether SCRIPT cmd should echo */ |
| #endif /* NOSCRIPT */ |
| |
| #ifdef DCMDBUF |
| extern char *atmbuf, *atxbuf; |
| #else |
| extern char atmbuf[], atxbuf[]; |
| #endif /* DCMDBUF */ |
| extern int cmflgs; |
| |
| extern char psave[]; |
| extern char uidbuf[]; |
| extern int sl_uid_saved; |
| int DeleteStartupFile = 0; |
| |
| extern int cmdlvl; /* Overall command level */ |
| |
| #ifndef NOSPL |
| _PROTOTYP( static int parsdir, (int) ); |
| char prmbuf[PWBUFL+1] = { NUL, NUL }; |
| int fndiags = 1; /* Function diagnostics on/off */ |
| int fnerror = 1; /* Function error treatment */ |
| |
| #ifdef DCMDBUF |
| extern int *count, *takerr, *merror, *inpcas; |
| #else |
| extern int count[], takerr[], merror[], inpcas[]; |
| #endif /* DCMDBUF */ |
| extern int mecho; /* Macro echo */ |
| extern long ck_alarm; |
| extern char alrm_date[], alrm_time[]; |
| #else |
| extern int takerr[]; |
| #endif /* NOSPL */ |
| |
| extern int x_ifnum; |
| extern int bigsbsiz, bigrbsiz; /* Packet buffers */ |
| |
| extern long speed; /* Terminal speed */ |
| |
| extern char ttname[]; /* Communication device name */ |
| extern char myhost[] ; |
| extern char inidir[]; /* Ini File directory */ |
| |
| #ifndef NOSETKEY |
| extern KEY *keymap; /* Character map for SET KEY (1:1) */ |
| extern MACRO *macrotab; /* Macro map for SET KEY (1:string) */ |
| #endif /* NOSETKEY */ |
| #ifdef OS2 |
| int wideresult; /* For wide OS/2 scan codes/cmnum() */ |
| #endif /* OS2 */ |
| |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| extern int tt_scrsize[]; /* Scrollback buffer Sizes */ |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| |
| /* Printer settings */ |
| |
| extern char * printername; /* NULL if printer not redirected */ |
| extern int printpipe; |
| extern int noprinter; |
| #ifdef PRINTSWI |
| int printtimo = 0; |
| char * printterm = NULL; |
| char * printsep = NULL; |
| int printertype = 0; |
| #ifdef BPRINT |
| int printbidi = 0; /* SET BPRINTER (bidirectional) */ |
| long pportspeed = 0L; /* Bidirection printer port speed, */ |
| int pportparity = 0; /* parity, */ |
| int pportflow = FLO_KEEP; /* and flow control */ |
| #endif /* BPRINT */ |
| #ifdef OS2 |
| extern int txt2ps; /* Text2PS conversion? */ |
| extern int ps_width, ps_length; /* Text2PS dimensions */ |
| #endif /* OS2 */ |
| #endif /* PRINTSWI */ |
| |
| #ifdef OS2 |
| extern int tcp_avail; /* Nonzero if TCP/IP is available */ |
| #ifdef DECNET |
| extern int dnet_avail; /* Ditto for DECnet */ |
| #endif /* DECNET */ |
| #ifdef SUPERLAT |
| extern int slat_avail; |
| #endif /* SUPERLAT */ |
| #endif /* OS2 */ |
| |
| static struct keytab logintab[] = { |
| { "password", LOGI_PSW, CM_INV }, |
| { "prompt", LOGI_PRM, CM_INV }, |
| { "userid", LOGI_UID, 0 } |
| }; |
| |
| #ifndef NOCSETS |
| /* system-independent character sets, defined in ckcxla.[ch] */ |
| extern struct csinfo tcsinfo[]; |
| extern struct langinfo langs[]; |
| |
| /* Other character-set related variables */ |
| extern int tcharset, tslevel, language; |
| #endif /* NOCSETS */ |
| |
| /* File-transfer variable declarations */ |
| |
| #ifndef NOXFER |
| #ifdef CK_AUTODL |
| extern int cmdadl; |
| #endif /* CK_AUTODL */ |
| |
| #ifndef NOSERVER |
| extern int ngetpath; |
| extern char * getpath[]; |
| #endif /* NOSERVER */ |
| |
| extern struct ck_p ptab[]; |
| |
| extern CHAR sstate; /* Protocol start state */ |
| extern CHAR myctlq; /* Control-character prefix */ |
| extern CHAR myrptq; /* Repeat-count prefix */ |
| |
| extern int protocol, size, spsiz, spmax, urpsiz, srvtim, srvcdmsg, slostart, |
| srvdis, xfermode, ckdelay, keep, maxtry, unkcs, bctr, ebqflg, swcapr, |
| wslotr, lscapr, lscapu, spsizr, rptena, rptmin, docrc, xfrcan, xfrchr, |
| xfrnum, xfrbel, xfrint, srvping, g_xfermode, xfrxla; |
| |
| #ifdef PIPESEND |
| extern int usepipes; |
| #endif /* PIPESEND */ |
| |
| #ifdef CKXXCHAR /* DOUBLE / IGNORE char table */ |
| extern int dblflag, ignflag, dblchar; |
| extern short dblt[]; |
| #endif /* CKXXCHAR */ |
| |
| #ifdef CK_SPEED |
| extern short ctlp[]; /* Control-prefix table */ |
| extern int prefixing; |
| static struct keytab pfxtab[] = { |
| "all", PX_ALL, 0, |
| "cautious", PX_CAU, 0, |
| "minimal", PX_WIL, 0, |
| "none", PX_NON, 0 |
| }; |
| #endif /* CK_SPEED */ |
| #endif /* NOXFER */ |
| |
| /* Declarations from cmd package */ |
| |
| #ifdef DCMDBUF |
| extern char *cmdbuf; /* Command buffer */ |
| extern char *line; |
| extern char *tmpbuf; |
| #else |
| extern char cmdbuf[]; /* Command buffer */ |
| extern char line[]; /* Character buffer for anything */ |
| extern char tmpbuf[]; |
| #endif /* DCMDBUF */ |
| |
| /* From main ckuser module... */ |
| |
| extern char *tp, *lp; /* Temporary buffer */ |
| |
| extern int tlevel; /* Take Command file level */ |
| |
| #ifndef NOLOCAL |
| extern int sessft; /* Session-log file type */ |
| extern int slogts; /* Session-log timestamps on/off */ |
| #endif /* NOLOCAL */ |
| |
| char * tempdir = NULL; |
| |
| #ifdef VMS |
| int vms_msgs = 1; /* SET MESSAGES */ |
| extern int batch; |
| #endif /* VMS */ |
| |
| /* Keyword tables for SET commands */ |
| |
| #ifdef CK_SPEED |
| struct keytab ctltab[] = { |
| "prefixed", 1, 0, /* Note, the values are important. */ |
| "unprefixed", 0, 0 |
| }; |
| #endif /* CK_SPEED */ |
| |
| static struct keytab oldnew[] = { |
| "new", 0, 0, |
| "old", 1, 0 |
| }; |
| |
| #define MCH_FIFO 1 |
| #define MCH_DOTF 2 |
| struct keytab matchtab[] = { |
| { "dotfile", MCH_DOTF, 0 }, |
| { "fifo", MCH_FIFO, 0 } |
| }; |
| int nmatchtab = (sizeof(matchtab) / sizeof(struct keytab)); |
| |
| #ifndef NOSPL |
| static struct keytab functab[] = { |
| "diagnostics", FUNC_DI, 0, |
| "error", FUNC_ER, 0 |
| }; |
| static int nfunctab = (sizeof(functab) / sizeof(struct keytab)); |
| |
| struct keytab outptab[] = { /* SET OUTPUT parameters */ |
| "pacing", 0, 0, /* only one so far... */ |
| "special-escapes", 1, 0 |
| }; |
| int noutptab = (sizeof(outptab) / sizeof(struct keytab)); /* How many */ |
| #endif /* NOSPL */ |
| |
| struct keytab chktab[] = { /* Block check types */ |
| "1", 1, 0, /* 1 = 6-bit checksum */ |
| "2", 2, 0, /* 2 = 12-bit checksum */ |
| "3", 3, 0, /* 3 = 16-bit CRC */ |
| "4", 4, CM_INV, /* Same as B */ |
| "blank-free-2", 4, 0 /* B = 12-bit checksum, no blanks */ |
| }; |
| |
| struct keytab rpttab[] = { /* SET REPEAT */ |
| "counts", 0, 0, /* On or Off */ |
| #ifdef COMMENT |
| "minimum", 1, 0, /* Threshhold */ |
| #endif /* COMMENT */ |
| "prefix", 2, 0 /* Repeat-prefix character value */ |
| }; |
| |
| #ifndef NOLOCAL |
| /* For SET [ MODEM ] CARRIER, and also for SET DIAL CONNECT */ |
| |
| struct keytab crrtab[] = { |
| "automatic", CAR_AUT, 0, /* 2 */ |
| "off", CAR_OFF, 0, /* 0 */ |
| "on", CAR_ON, 0 /* 1 */ |
| }; |
| int ncrr = 3; |
| #endif /* NOLOCAL */ |
| |
| struct keytab ooatab[] = { /* On/Off/Auto table */ |
| "automatic", SET_AUTO, 0, /* 2 */ |
| "off", SET_OFF, 0, /* 0 */ |
| "on", SET_ON, 0 /* 1 */ |
| }; |
| |
| struct keytab ooktab[] = { /* On/Off/Ask table */ |
| "ask", 2, 0, /* 2 */ |
| "off", SET_OFF, 0, /* 0 */ |
| "on", SET_ON, 0 /* 1 */ |
| }; |
| |
| struct keytab qvtab[] = { /* Quiet/Verbose table */ |
| "quiet", 1, 0, |
| "verbose", 0, 0 |
| }; |
| int nqvt = 2; |
| |
| /* For SET DEBUG */ |
| |
| #define DEB_OFF 0 |
| #define DEB_ON 1 |
| #define DEB_SES 2 |
| #define DEB_TIM 3 |
| #define DEB_LEN 4 |
| |
| struct keytab dbgtab[] = { |
| "linelength", DEB_LEN, CM_INV, |
| "off", DEB_OFF, 0, |
| "on", DEB_ON, 0, |
| "session", DEB_SES, 0, |
| "timestamps", DEB_TIM, 0 |
| }; |
| int ndbg = (sizeof(dbgtab) / sizeof(struct keytab)); |
| |
| #ifndef NOLOCAL |
| /* Transmission speeds */ |
| |
| #ifdef TTSPDLIST /* Speed table constructed at runtime . . . */ |
| |
| struct keytab * spdtab = NULL; |
| int nspd = 0; |
| |
| #else |
| /* |
| Note, the values are encoded in cps rather than bps because 19200 and higher |
| are too big for some ints. All but 75bps are multiples of ten. Result of |
| lookup in this table must be multiplied by 10 to get actual speed in bps. |
| If this number is 70, it must be changed to 75. If it is 888, this means |
| 75/1200 split speed. |
| |
| The values are generic, rather than specific to UNIX. We can't use B75, |
| B1200, B9600, etc, because non-UNIX versions of C-Kermit will not |
| necessarily have these symbols defined. The BPS_xxx symbols are |
| Kermit-specific, and are defined in ckcdeb.h or on the CC command line. |
| |
| Like all other keytabs, this one must be in "alphabetical" order, |
| rather than numeric order. |
| */ |
| struct keytab spdtab[] = { |
| "0", 0, CM_INV, |
| "110", 11, 0, |
| #ifdef BPS_115K |
| "115200",11520, 0, |
| #endif /* BPS_115K */ |
| "1200", 120, 0, |
| #ifdef BPS_134 |
| "134.5", 134, 0, |
| #endif /* BPS_134 */ |
| #ifdef BPS_14K |
| "14400", 1440, 0, |
| #endif /* BPS_14K */ |
| #ifdef BPS_150 |
| "150", 15, 0, |
| #endif /* BPS_150 */ |
| #ifdef BPS_1800 |
| "1800", 180, 0, |
| #endif /* BPS_150 */ |
| #ifdef BPS_19K |
| "19200", 1920, 0, |
| #endif /* BPS_19K */ |
| #ifdef BPS_200 |
| "200", 20, 0, |
| #endif /* BPS_200 */ |
| #ifdef BPS_230K |
| "230400", 23040, 0, |
| #endif /* BPS_230K */ |
| "2400", 240, 0, |
| #ifdef BPS_28K |
| "28800", 2880, 0, |
| #endif /* BPS_28K */ |
| "300", 30, 0, |
| #ifdef BPS_3600 |
| "3600", 360, 0, |
| #endif /* BPS_3600 */ |
| #ifdef BPS_38K |
| "38400", 3840, 0, |
| #endif /* BPS_38K */ |
| #ifdef BPS_460K |
| "460800", 46080, 0, /* Need 32 bits for this... */ |
| #endif /* BPS_460K */ |
| "4800", 480, 0, |
| #ifdef BPS_50 |
| "50", 5, 0, |
| #endif /* BPS_50 */ |
| #ifdef BPS_57K |
| "57600", 5760, 0, |
| #endif /* BPS_57K */ |
| "600", 60, 0, |
| #ifdef BPS_7200 |
| "7200", 720, 0, |
| #endif /* BPS_7200 */ |
| #ifdef BPS_75 |
| "75", 7, 0, |
| #endif /* BPS_75 */ |
| #ifdef BPS_7512 |
| "75/1200",888, 0, /* Code "888" for split speed */ |
| #endif /* BPS_7512 */ |
| #ifdef BPS_76K |
| "76800", 7680, 0, |
| #endif /* BPS_76K */ |
| #ifdef BPS_921K |
| "921600", 92160,0, /* Need 32 bits for this... */ |
| #endif /* BPS_921K */ |
| "9600", 960, 0 |
| }; |
| int nspd = (sizeof(spdtab) / sizeof(struct keytab)); /* How many speeds */ |
| #endif /* TTSPDLIST */ |
| |
| #ifdef TN_COMPORT |
| struct keytab tnspdtab[] = { /* RFC 2217 TELNET COMPORT Option */ |
| "115200", 11520, 0, /* (add any other defined speeds) */ |
| "1200", 120, 0, |
| "14400", 1440, 0, |
| "19200", 1920, 0, |
| "230400", 23040, 0, |
| "2400", 240, 0, |
| "28800", 2880, 0, |
| "300", 30, 0, |
| "38400", 3840, 0, |
| "460800", 46080, 0, |
| "4800", 480, 0, |
| "57600", 5760, 0, |
| "600", 60, 0, |
| "9600", 960, 0 |
| }; |
| int ntnspd = (sizeof(tnspdtab) / sizeof(struct keytab)); /* How many speeds */ |
| #endif /* TN_COMPORT */ |
| #endif /* NOLOCAL */ |
| |
| #ifndef NOCSETS |
| extern struct keytab lngtab[]; /* Languages for SET LANGUAGE */ |
| extern int nlng; |
| #endif /* NOCSETS */ |
| |
| #ifndef NOLOCAL |
| /* Duplex keyword table */ |
| |
| struct keytab dpxtab[] = { |
| "full", 0, 0, |
| "half", 1, 0 |
| }; |
| #endif /* NOLOCAL */ |
| |
| /* Flow Control */ |
| |
| struct keytab cxtypesw[] = { |
| #ifdef DECNET |
| "/decnet", CXT_DECNET, 0, |
| #endif /* DECNET */ |
| "/direct-serial", CXT_DIRECT, 0, |
| #ifdef DECNET |
| "/lat", CXT_LAT, 0, |
| #else |
| #ifdef SUPERLAT |
| "/lat", CXT_LAT, 0, |
| #endif /* SUPERLAT */ |
| #endif /* DECNET */ |
| "/modem", CXT_MODEM, 0, |
| #ifdef NPIPE |
| "/named-pipe", CXT_NPIPE, 0, |
| #endif /* NPIPE */ |
| #ifdef NETBIOS |
| "/netbios", CXT_NETBIOS, 0, |
| #endif /* NETBIOS */ |
| "/remote", CXT_REMOTE, 0, |
| #ifdef TCPSOCKET |
| "/tcpip", CXT_TCPIP, 0, |
| #endif /* TCPSOCKET */ |
| #ifdef ANYX25 |
| "/x.25", CXT_X25, 0, |
| #endif /* ANYX25 */ |
| "", 0, 0 |
| }; |
| int ncxtypesw = (sizeof(cxtypesw) / sizeof(struct keytab)); |
| |
| #ifdef TN_COMPORT |
| struct keytab tnflotab[] = { /* SET FLOW-CONTROL keyword table */ |
| "dtr/cd", FLO_DTRC, 0, /* for RFC 2217 Telnet COMPORT */ |
| "dtr/cts", FLO_DTRT, 0, |
| "keep", FLO_KEEP, 0, |
| "none", FLO_NONE, 0, |
| "rts/cts", FLO_RTSC, 0, |
| "xon/xoff", FLO_XONX, 0 |
| }; |
| int ntnflo = (sizeof(tnflotab) / sizeof(struct keytab)); |
| #endif /* TN_COMPORT */ |
| |
| struct keytab flotab[] = { /* SET FLOW-CONTROL keyword table */ |
| "automatic", FLO_AUTO, CM_INV, /* Not needed any more */ |
| #ifdef CK_DTRCD |
| "dtr/cd", FLO_DTRC, 0, |
| #endif /* CK_DTRCD */ |
| #ifdef CK_DTRCTS |
| "dtr/cts", FLO_DTRT, 0, |
| #endif /* CK_DTRCTS */ |
| "keep", FLO_KEEP, 0, |
| "none", FLO_NONE, 0, |
| #ifdef CK_RTSCTS |
| "rts/cts", FLO_RTSC, 0, |
| #endif /* CK_RTSCTS */ |
| #ifndef Plan9 |
| "xon/xoff", FLO_XONX, 0, |
| #endif /* Plan9 */ |
| "", 0, 0 |
| }; |
| int nflo = (sizeof(flotab) / sizeof(struct keytab)) - 1; |
| |
| /* Handshake characters */ |
| |
| struct keytab hshtab[] = { |
| "bell", 007, 0, |
| "code", 998, 0, |
| "cr", 015, 0, |
| "esc", 033, 0, |
| "lf", 012, 0, |
| "none", 999, 0, /* (can't use negative numbers) */ |
| "xoff", 023, 0, |
| "xon", 021, 0 |
| }; |
| int nhsh = (sizeof(hshtab) / sizeof(struct keytab)); |
| |
| #ifndef NOLOCAL |
| static struct keytab sfttab[] = { /* File types for SET SESSION-LOG */ |
| "ascii", XYFT_T, CM_INV, |
| "binary", XYFT_B, 0, |
| "debug", XYFT_D, 0, |
| "text", XYFT_T, 0, |
| "timestamped-text", 999, 0 |
| }; |
| static int nsfttab = (sizeof(sfttab) / sizeof(struct keytab)); |
| #endif /* NOLOCAL */ |
| |
| #ifndef NODIAL |
| |
| #ifdef NETCONN /* Networks directory depends */ |
| int nnetdir = 0; /* on DIAL code -- fix later... */ |
| char *netdir[MAXDDIR+2]; |
| #endif /* NETCONN */ |
| |
| _PROTOTYP( static int setdial, (int) ); |
| _PROTOTYP( static int setdcd, (void) ); |
| _PROTOTYP( static int cklogin, (void) ); |
| |
| #ifndef MINIDIAL |
| #ifdef OLDTBCODE |
| extern int tbmodel; /* Telebit model ID */ |
| #endif /* OLDTBCODE */ |
| #endif /* MINIDIAL */ |
| |
| extern MDMINF *modemp[]; /* Pointers to modem info structs */ |
| extern struct keytab mdmtab[]; /* Modem types (in module ckudia.c) */ |
| extern int nmdm; /* Number of them */ |
| |
| _PROTOTYP(static int dialstr,(char **, char *)); |
| |
| extern int dialhng, dialtmo, dialksp, dialdpy, dialmhu, dialec, dialdc; |
| extern int dialrtr, dialint, dialudt, dialsrt, dialrstr, mdmwaitd; |
| extern int mdmspd, dialfc, dialmth, dialesc, dialfld, dialidt, dialpace; |
| extern int mdmspk, mdmvol, dialtest; |
| |
| int dialcvt = 2; /* DIAL CONVERT-DIRECTORY */ |
| int dialcnf = 0; /* DIAL CONFIRMATION */ |
| int dialcon = 2; /* DIAL CONNECT */ |
| int dialcq = 0; /* DIAL CONNECT AUTO quiet/verbose */ |
| extern long dialmax, dialcapas; |
| int usermdm = 0; |
| extern int ndialdir; |
| extern char *dialini, *dialmstr, *dialmprmt, *dialdir[], *dialcmd, *dialnpr, |
| *dialdcon, *dialdcoff, *dialecon, *dialecoff, *dialhcmd, *dialx3, |
| *dialhwfc, *dialswfc, *dialnofc, *dialtone, *dialpulse, *dialname, *diallac; |
| extern char *diallcc, *dialixp, *dialixs, *dialldp, *diallds, *dialtfp, |
| *dialpxi, *dialpxo, *dialsfx, *dialaaon, *dialaaoff; |
| extern char *diallcp, *diallcs, *dialini2, *dialmac; |
| extern char *dialspoff, *dialspon, *dialvol1, *dialvol2, *dialvol3; |
| |
| char *dialtocc[MAXTPCC] = { NULL, NULL }; |
| int ndialtocc = 0; |
| char *dialpucc[MAXTPCC] = { NULL, NULL }; |
| int ndialpucc = 0; |
| |
| char *dialtfc[MAXTOLLFREE] = { |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL |
| }; |
| int ntollfree = 0; |
| |
| char *dialpxx[MAXPBXEXCH] = { |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL |
| }; |
| int ndialpxx = 0; |
| |
| char *diallcac[MAXLOCALAC] = { |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL |
| }; |
| int nlocalac = 0; |
| |
| static struct keytab drstrtab[] = { |
| "international", 5, 0, |
| "local", 2, 0, |
| "long-distance", 4, 0, |
| "none", 6, 0 |
| }; |
| |
| static struct keytab dcnvtab[] = { |
| "ask", 2, 0, |
| "off", 0, 0, |
| "on", 1, 0 |
| }; |
| |
| struct keytab setmdm[] = { |
| "capabilities", XYDCAP, 0, |
| "carrier-watch", XYDMCD, 0, |
| "command", XYDSTR, 0, |
| "compression", XYDDC, CM_INV, |
| "data-compression", XYDDC, 0, |
| "dial-command", XYDDIA, 0, |
| "error-correction", XYDEC, 0, |
| "escape-character", XYDESC, 0, |
| "flow-control", XYDFC, 0, |
| "hangup-method", XYDMHU, 0, |
| #ifndef NOXFER |
| "kermit-spoof", XYDKSP, 0, |
| #endif /* NOXFER */ |
| "maximum-speed", XYDMAX, 0, |
| "name", XYDNAM, 0, |
| "speaker", XYDSPK, 0, |
| "speed-matching", XYDSPD, 0, |
| "type", XYDTYP, 0, |
| "volume", XYDVOL, 0 |
| }; |
| int nsetmdm = (sizeof(setmdm) / sizeof(struct keytab)); |
| |
| struct keytab voltab[] = { |
| "high", 3, 0, |
| "low", 1, 0, |
| "medium", 2, 0 |
| }; |
| |
| struct keytab mdmcap[] = { |
| "at-commands", CKD_AT, 0, |
| "compression", CKD_DC, 0, |
| "dc", CKD_DC, CM_INV, |
| "ec", CKD_EC, CM_INV, |
| "error-correction", CKD_EC, 0, |
| "hardware-flow", CKD_HW, 0, |
| "hwfc", CKD_HW, CM_INV, |
| "itu", CKD_V25, CM_INV, |
| "kermit-spoof", CKD_KS, 0, |
| "ks", CKD_KS, CM_INV, |
| "sb", CKD_SB, CM_INV, |
| "software-flow", CKD_SW, 0, |
| "speed-buffering", CKD_SB, 0, |
| "swfc", CKD_SW, CM_INV, |
| "tb", CKD_TB, CM_INV, |
| "telebit", CKD_TB, 0, |
| "v25bis-commands", CKD_V25, 0 |
| }; |
| int nmdmcap = (sizeof(mdmcap) / sizeof(struct keytab)); |
| |
| #ifdef COMMENT /* SET ANSWER not implemented yet */ |
| static struct keytab answertab[] = { |
| { "caller-id", XYA_CID, 0 }; |
| { "rings", XYA_RNG, 0 }; |
| { "", 0, 0 } |
| }; |
| static int nanswertab = (sizeof(answertab) / sizeof(struct keytab)) - 1; |
| #endif /* COMMENT */ |
| |
| struct keytab dialtab[] = { /* SET DIAL table */ |
| "area-code", XYDLAC, 0, /* Also still includes items */ |
| "compression", XYDDC, CM_INV, /* that were moved to SET MODEM, */ |
| "confirmation", XYDCNF, 0, /* but they are CM_INVisible... */ |
| "connect", XYDCON, 0, |
| "convert-directory",XYDCVT, 0, |
| "country-code", XYDLCC, 0, |
| "dial-command", XYDDIA, CM_INV, |
| "directory", XYDDIR, 0, |
| "display", XYDDPY, 0, |
| "escape-character", XYDESC, CM_INV, |
| "error-correction", XYDEC, CM_INV, |
| "flow-control", XYDFC, CM_INV, |
| "force-long-distance", XYDFLD, 0, |
| "hangup", XYDHUP, 0, |
| "ignore-dialtone", XYDIDT, 0, |
| "interval", XYDINT, 0, |
| "in", XYDINI, CM_INV|CM_ABR, |
| "init-string", XYDINI, CM_INV, |
| "intl-prefix", XYDIXP, 0, |
| "intl-suffix", XYDIXS, 0, |
| #ifndef NOXFER |
| "kermit-spoof", XYDKSP, CM_INV, |
| #endif /* NOXFER */ |
| "lc-area-codes", XYDLLAC, 0, |
| "lc-prefix", XYDLCP, 0, |
| "lc-suffix", XYDLCS, 0, |
| "ld-prefix", XYDLDP, 0, |
| "ld-suffix", XYDLDS, 0, |
| "local-area-code", XYDLAC, CM_INV, |
| "local-prefix", XYDLCP, CM_INV, |
| "local-suffix", XYDLCS, CM_INV, |
| "m", XYDMTH, CM_INV|CM_ABR, |
| #ifndef NOSPL |
| "macro", XYDMAC, 0, /* 195 */ |
| #endif /* NOSPL */ |
| #ifdef MDMHUP |
| "me", XYDMTH, CM_INV|CM_ABR, |
| #endif /* MDMHUP */ |
| "method", XYDMTH, 0, |
| "mnp-enable", XYDMNP, CM_INV, /* obsolete but still accepted */ |
| #ifdef MDMHUP |
| "modem-hangup", XYDMHU, CM_INV, |
| #endif /* MDMHUP */ |
| "pacing", XYDPAC, 0, |
| "pbx-exchange", XYDPXX, 0, |
| "pbx-inside-prefix",XYDPXI, 0, |
| "pbx-outside-prefix",XYDPXO, 0, |
| "prefix", XYDNPR, 0, |
| "pulse-countries", XYDPUCC, 0, |
| "restrict", XYDRSTR, 0, |
| "retries", XYDRTM, 0, |
| "sort", XYDSRT, 0, |
| "speed-matching", XYDSPD, CM_INV, |
| "string", XYDSTR, CM_INV, |
| "suffix", XYDSFX, 0, |
| "test", XYDTEST, 0, |
| "timeout", XYDTMO, 0, |
| "tf-area-code", XYDTFC, CM_INV, |
| "tf-prefix", XYDTFP, CM_INV, |
| "toll-free-area-code",XYDTFC,0, |
| "toll-free-prefix", XYDTFP, 0, |
| "tone-countries", XYDTOCC, 0 |
| }; |
| int ndial = (sizeof(dialtab) / sizeof(struct keytab)); |
| |
| #ifdef MDMHUP |
| struct keytab mdmhang[] = { |
| "dtr", 0, 0, |
| "modem-command", 1, 0, |
| "rs232-signal", 0, 0, |
| "v24-signal", 0, CM_INV |
| }; |
| #endif /* MDMHUP */ |
| |
| static struct keytab mdmcmd[] = { |
| "autoanswer", XYDS_AN, 0, /* autoanswer */ |
| "compression", XYDS_DC, 0, /* data compression */ |
| "dial-mode-prompt", XYDS_MP, 0, /* dial mode prompt */ |
| "dial-mode-string", XYDS_MS, 0, /* dial mode string */ |
| "error-correction", XYDS_EC, 0, /* error correction */ |
| "hangup-command", XYDS_HU, 0, /* hangup command */ |
| "hardware-flow", XYDS_HW, 0, /* hwfc */ |
| "ignore-dialtone", XYDS_ID, 0, /* ignore dialtone */ |
| "init-string", XYDS_IN, 0, /* init string */ |
| "no-flow-control", XYDS_NF, 0, /* no flow control */ |
| "predial-init", XYDS_I2, 0, /* last-minute setup commands */ |
| "pulse", XYDS_DP, 0, /* pulse */ |
| "software-flow", XYDS_SW, 0, /* swfc */ |
| "speaker", XYDS_SP, 0, /* Speaker */ |
| "tone", XYDS_DT, 0, /* tone */ |
| "volume", XYDS_VO, 0 /* Volume */ |
| }; |
| static int nmdmcmd = (sizeof(mdmcmd) / sizeof(struct keytab)); |
| |
| struct keytab dial_fc[] = { |
| "auto", FLO_AUTO, 0, |
| "none", FLO_NONE, 0, |
| "rts/cts", FLO_RTSC, 0, |
| "xon/xoff", FLO_XONX, 0 |
| }; |
| |
| struct keytab dial_m[] = { /* DIAL METHOD */ |
| "auto", XYDM_A, 0, |
| "default", XYDM_D, 0, |
| "pulse", XYDM_P, 0, |
| "tone", XYDM_T, 0 |
| }; |
| int ndial_m = (sizeof(dial_m)/sizeof(struct keytab)); |
| #endif /* NODIAL */ |
| |
| #ifdef CK_TAPI |
| struct keytab tapitab[] = { /* Top-Level Microsoft TAPI */ |
| "configure-line", XYTAPI_CFG, 0, |
| "dialing-properties", XYTAPI_DIAL, 0 |
| }; |
| int ntapitab = (sizeof(tapitab)/sizeof(struct keytab)); |
| |
| struct keytab settapitab[] = { /* SET Microsoft TAPI */ |
| "inactivity-timeout", XYTAPI_INA, 0, |
| "line", XYTAPI_LIN, 0, |
| "location", XYTAPI_LOC, 0, |
| "manual-dialing", XYTAPI_MAN, 0, |
| "modem-dialing", XYTAPI_PASS, 0, |
| "modem-lights", XYTAPI_LGHT, 0, |
| "phone-number-conversions", XYTAPI_CON, 0, |
| "port", XYTAPI_LIN, CM_INV, |
| "post-dial-terminal", XYTAPI_PST, 0, |
| "pre-dial-terminal", XYTAPI_PRE, 0, |
| "use-windows-configuration", XYTAPI_USE, 0, |
| "wait-for-credit-card-tone", XYTAPI_BNG, 0 |
| }; |
| int nsettapitab = (sizeof(settapitab)/sizeof(struct keytab)); |
| |
| struct keytab * tapiloctab = NULL; /* Microsoft TAPI Locations */ |
| int ntapiloc = 0; |
| extern struct keytab * tapilinetab; /* Microsoft TAPI Line Devices */ |
| extern int ntapiline; |
| extern int tttapi; /* TAPI in use */ |
| extern int tapipass; /* TAPI Passthrough mode */ |
| extern int tapiconv; /* TAPI Conversion mode */ |
| extern int tapilights; |
| extern int tapipreterm; |
| extern int tapipostterm; |
| extern int tapimanual; |
| extern int tapiinactivity; |
| extern int tapibong; |
| extern int tapiusecfg; |
| #endif /* CK_TAPI */ |
| |
| #ifndef NOPUSH |
| extern int nopush; |
| #ifdef UNIX |
| struct keytab wildtab[] = { /* SET WILDCARD-EXPANSION */ |
| "kermit", 0, 0, |
| "shell", 1, 0 |
| }; |
| struct keytab wdottab[] = { /* cont'd */ |
| "/match-dot-files", 1, 0, |
| "/no-match-dot-files", 0, 0 |
| }; |
| extern int wildxpand; |
| #endif /* UNIX */ |
| #endif /* NOPUSH */ |
| |
| #ifdef NETCONN |
| extern struct keytab netcmd[], netkey[]; |
| extern int nnets, nnetkey; |
| #ifdef TCPSOCKET |
| extern struct keytab tcpopt[]; |
| extern int ntcpopt; |
| #endif /* TCPSOCKET */ |
| #ifdef NPIPE |
| char pipename[PIPENAML+1] = { NUL, NUL }; |
| #endif /* NPIPE */ |
| #ifdef CK_NETBIOS |
| extern unsigned char NetBiosName[]; |
| #endif /* CK_NETBIOS */ |
| #endif /* NETCONN */ |
| |
| #ifdef ANYX25 |
| struct keytab x25tab[] = { |
| "call-user-data", XYUDAT, 0, |
| "closed-user-group", XYCLOS, 0, |
| "reverse-charge", XYREVC, 0 |
| }; |
| int nx25 = (sizeof(x25tab) / sizeof(struct keytab)); |
| |
| #ifndef IBMX25 |
| struct keytab padx3tab[] = { |
| "break-action", PAD_BREAK_ACTION, 0, |
| "break-character", PAD_BREAK_CHARACTER, 0, |
| "character-delete", PAD_CHAR_DELETE_CHAR, 0, |
| "cr-padding", PAD_PADDING_AFTER_CR, 0, |
| "discard-output", PAD_SUPPRESSION_OF_DATA, 0, |
| "echo", PAD_ECHO, 0, |
| "editing", PAD_EDITING, 0, |
| "escape", PAD_ESCAPE, 0, |
| "forward", PAD_DATA_FORWARD_CHAR, 0, |
| "lf-padding", PAD_PADDING_AFTER_LF, 0, |
| "lf-insert", PAD_LF_AFTER_CR, 0, |
| "line-delete", PAD_BUFFER_DELETE_CHAR, 0, |
| "line-display", PAD_BUFFER_DISPLAY_CHAR, 0, |
| "line-fold", PAD_LINE_FOLDING, 0, |
| "pad-flow-control", PAD_FLOW_CONTROL_BY_PAD, 0, |
| "service-signals", PAD_SUPPRESSION_OF_SIGNALS, 0, |
| "timeout", PAD_DATA_FORWARD_TIMEOUT, 0, |
| /* Speed is read-only */ |
| "transmission-rate", PAD_LINE_SPEED, 0, |
| "user-flow-control", PAD_FLOW_CONTROL_BY_USER, 0 |
| }; |
| int npadx3 = (sizeof(padx3tab) / sizeof(struct keytab)); |
| #endif /* IBMX25 */ |
| #endif /* ANYX25 */ |
| |
| #ifdef TLOG |
| static struct keytab vbtab[] = { |
| "brief", 0, 0, |
| #ifdef OS2ORUNIX |
| "ftp", 2, 0, |
| #endif /* OS2ORUNIX */ |
| "verbose", 1, 0 |
| }; |
| int nvb = (sizeof(vbtab) / sizeof(struct keytab)); |
| #endif /* TLOG */ |
| |
| #ifdef CKSYSLOG |
| static struct keytab syslogtab[] = { |
| "all", SYSLG_CX, 0, |
| "commands", SYSLG_CM, 0, |
| "connection", SYSLG_AC, 0, |
| "debug", SYSLG_DB, 0, |
| "dial", SYSLG_DI, 0, |
| "file-access", SYSLG_FA, 0, |
| "file-create", SYSLG_FC, 0, |
| "login", SYSLG_LI, 0, |
| "none", SYSLG_NO, 0, |
| "protocol", SYSLG_PR, 0 |
| }; |
| int nsyslog = (sizeof(syslogtab) / sizeof(struct keytab)); |
| #endif /* CKSYSLOG */ |
| |
| /* Parity keyword table */ |
| |
| struct keytab partbl[] = { |
| "even", 'e', 0, |
| #ifdef HWPARITY |
| "hardware",'H', 0, |
| #endif /* HWPARITY */ |
| "mark", 'm', 0, |
| "none", 0 , 0, |
| "odd", 'o', 0, |
| "space", 's', 0 |
| }; |
| int npar = (sizeof(partbl) / sizeof(struct keytab)); |
| |
| #ifdef HWPARITY |
| struct keytab hwpartbl[] = { |
| /* Add mark and space if needed and possible */ |
| "even", 'e', 0, |
| #ifdef OS2 |
| "mark", 'm', 0, |
| #endif /* OS2 */ |
| "odd", 'o', 0, |
| #ifdef OS2 |
| "space", 's', 0, |
| #endif /* OS2 */ |
| "", 0, 0 |
| }; |
| int nhwpar = (sizeof(hwpartbl) / sizeof(struct keytab)) - 1; |
| #endif /* HWPARITY */ |
| |
| /* On/Off table */ |
| |
| struct keytab onoff[] = { |
| "off", 0, 0, |
| "on", 1, 0 |
| }; |
| |
| #define XYCD_M 0 /* CD MESSAGE */ |
| #define XYCD_P 1 /* CD PATH */ |
| #define XYCD_H 2 /* CD HOME */ |
| |
| struct keytab cdtab[] = { |
| "home", XYCD_H, 0, |
| "message", XYCD_M, 0, |
| "path", XYCD_P, 0 |
| }; |
| int ncdtab = (sizeof(cdtab) / sizeof(struct keytab)); |
| |
| struct keytab cdmsg[] = { |
| "file", 2, 0, |
| "off", 0, 0, |
| "on", 1, 0 |
| }; |
| int ncdmsg = (sizeof(cdmsg) / sizeof(struct keytab)); |
| |
| static |
| struct keytab xittab[] = { /* SET EXIT */ |
| "hangup", 3, 0, /* ...HANGUP */ |
| "on-disconnect", 2, 0, /* ...ON-DISCONNECT */ |
| "status", 0, 0, /* ...STATUS */ |
| "warning", 1, 0 /* ...WARNING */ |
| }; |
| int nexit = (sizeof(xittab) / sizeof(struct keytab)); |
| |
| struct keytab xitwtab[] = { /* SET EXIT WARNING */ |
| "always", 2, 0, /* even when not connected */ |
| "off", 0, 0, /* no warning */ |
| "on", 1, 0 /* when connected */ |
| }; |
| int nexitw = (sizeof(xitwtab) / sizeof(struct keytab)); |
| |
| struct keytab rltab[] = { |
| "local", 1, 0, /* ECHO values */ |
| "off", 0, CM_INV, |
| "on", 1, CM_INV, |
| "remote", 0, 0 |
| }; |
| int nrlt = (sizeof(rltab) / sizeof(struct keytab)); |
| |
| /* Incomplete File Disposition table */ |
| |
| struct keytab ifdtab[] = { |
| "discard", SET_OFF, 0, |
| "keep", SET_ON, 0 |
| }; |
| |
| struct keytab ifdatab[] = { |
| "auto", SET_AUTO, 0, |
| "discard", SET_OFF, 0, |
| "keep", SET_ON, 0 |
| }; |
| |
| char * ifdnam[] = { "discard", "keep", "auto" }; |
| |
| /* SET TAKE parameters table */ |
| static |
| struct keytab taktab[] = { |
| "echo", 0, 0, |
| "error", 1, 0, |
| "off", 2, CM_INV, /* For compatibility */ |
| "on", 3, CM_INV /* with MS-DOS Kermit... */ |
| }; |
| |
| #ifndef NOSPL |
| #ifdef COMMENT |
| /* not used */ |
| static |
| struct keytab suftab[] = { /* (what to do with) STARTUP-FILE */ |
| "delete", 1, 0, |
| "keep", 0, 0 |
| }; |
| #endif /* COMMENT */ |
| |
| /* SET MACRO parameters table */ |
| static |
| struct keytab smactab[] = { |
| "echo", 0, 0, |
| "error", 1, 0 |
| }; |
| #endif /* NOSPL */ |
| |
| #ifndef NOSCRIPT |
| static |
| struct keytab scrtab[] = { |
| "echo", 0, 0 |
| }; |
| #endif /* NOSCRIPT */ |
| |
| /* SET COMMAND table */ |
| |
| /* SET COMMAND items... */ |
| |
| #define SCMD_BSZ 0 /* BYTESIZE */ |
| #define SCMD_RCL 1 /* RECALL */ |
| #define SCMD_RTR 2 /* RETRY */ |
| #define SCMD_QUO 3 /* QUOTING */ |
| #define SCMD_COL 4 /* COLOR */ |
| #define SCMD_HIG 5 /* HEIGHT */ |
| #define SCMD_WID 6 /* WIDTH */ |
| #define SCMD_CUR 7 /* CURSOR-POSITION */ |
| #define SCMD_SCR 8 /* SCROLLBACK */ |
| #define SCMD_MOR 9 /* MORE-PROMPTING */ |
| #define SCMD_INT 10 /* INTERRUPTION */ |
| #define SCMD_ADL 11 /* AUTODOWNLOAD */ |
| #define SCMD_STA 12 /* STATUSLINE */ |
| #define SCMD_DBQ 13 /* DOUBLEQUOTING */ |
| #define SCMD_CBR 14 /* CBREAK */ |
| #define SCMD_BFL 15 /* BUFFER-SIZE (not used) */ |
| |
| static struct keytab scmdtab[] = { |
| #ifdef CK_AUTODL |
| "autodownload", SCMD_ADL, 0, |
| #endif /* CK_AUTODL */ |
| #ifdef COMMENT |
| /* |
| To implement this requires that we change CMDBL and ATMBL |
| from compile-time symbols to runtime variables. Not a big deal, |
| but not trivial either. |
| */ |
| "buffer-size", SCMD_BFL, 0, |
| #endif /* COMMENT */ |
| "bytesize", SCMD_BSZ, 0, |
| "cbreak", SCMD_CBR, CM_INV, |
| #ifdef OS2 |
| "color", SCMD_COL, 0, |
| "cursor-position", SCMD_CUR, 0, |
| #endif /* OS2 */ |
| #ifdef DOUBLEQUOTING |
| "doublequoting", SCMD_DBQ, 0, |
| #endif /* DOUBLEQUOTING */ |
| "height", SCMD_HIG, 0, |
| "interruption", SCMD_INT, 0, |
| "more-prompting", SCMD_MOR, 0, |
| "quoting", SCMD_QUO, 0, |
| #ifdef CK_RECALL |
| "recall-buffer-size", SCMD_RCL, 0, |
| #endif /* CK_RECALL */ |
| #ifdef CK_RECALL |
| "retry", SCMD_RTR, 0, |
| #endif /* CK_RECALL */ |
| #ifdef OS2 |
| #ifdef ONETERMUPD |
| "scrollback", SCMD_SCR, 0, |
| "statusline", SCMD_STA, 0, |
| #endif /* ONETERMUPD */ |
| #endif /* OS2 */ |
| "width", SCMD_WID, 0 |
| }; |
| static int nbytt = (sizeof(scmdtab) / sizeof(struct keytab)); |
| |
| #ifndef NOSERVER |
| /* Server parameters table */ |
| static struct keytab srvtab[] = { |
| "cd-message", XYSERC, 0, |
| "display", XYSERD, 0, |
| "get-path", XYSERP, 0, |
| "idle-timeout", XYSERI, 0, |
| "keepalive", XYSERK, 0, |
| "login", XYSERL, 0, |
| "timeout", XYSERT, 0 |
| }; |
| static int nsrvt = (sizeof(srvtab) / sizeof(struct keytab)); |
| #endif /* NOSERVER */ |
| |
| static struct keytab sleeptab[] = { /* SET SLEEP table */ |
| "cancellation", 0, 0 |
| }; |
| |
| static struct keytab tstab[] = { /* SET TRANSFER/XFER table */ |
| "bell", XYX_BEL, 0, |
| #ifdef XFRCAN |
| "cancellation", XYX_CAN, 0, |
| #endif /* XFRCAN */ |
| #ifndef NOCSETS |
| "character-set", XYX_CSE, 0, |
| #endif /* NOCSETS */ |
| #ifndef NOSPL |
| "crc-calculation", XYX_CRC, 0, |
| #endif /* NOSPL */ |
| "display", XYX_DIS, 0, |
| "interruption", XYX_INT, 0, |
| "locking-shift", XYX_LSH, 0, |
| "message", XYX_MSG, 0, |
| "mode", XYX_MOD, 0, |
| "msg", XYX_MSG, CM_INV, |
| #ifdef PIPESEND |
| "pipes", XYX_PIP, 0, |
| #endif /* PIPESEND */ |
| #ifdef CK_XYZ |
| "protocol", XYX_PRO, 0, |
| #endif /* CK_XYZ */ |
| "report", XYX_RPT, 0, |
| "slow-start", XYX_SLO, 0, |
| #ifndef NOCSETS |
| "translation", XYX_XLA, 0, |
| #else |
| "translation", XYX_XLA, CM_INV, |
| #endif /* NOCSETS */ |
| "xlation", XYX_XLA, CM_INV, |
| "", 0, 0 |
| }; |
| static int nts = (sizeof(tstab) / sizeof(struct keytab)) - 1; |
| |
| static struct keytab rtstab[] = { /* REMOTE SET TRANSFER/XFER table */ |
| #ifndef NOCSETS |
| "character-set", XYX_CSE, 0, |
| #endif /* NOCSETS */ |
| "mode", XYX_MOD, 0 |
| }; |
| static int nrts = (sizeof(rtstab) / sizeof(struct keytab)); |
| |
| struct keytab xfrmtab[] = { /* TRANSFER MODE table */ |
| "automatic", XMODE_A, 0, |
| "manual", XMODE_M, 0 |
| }; |
| |
| #ifdef LOCUS |
| extern int locus, autolocus; |
| |
| static struct keytab locustab[] = { |
| #ifdef KUI |
| { "ask", 3, 0 }, /* Presently implemented in GUI only */ |
| #endif /* KUI */ |
| { "auto", 2, 0 }, |
| { "local", 1, 0 }, |
| { "remote", 0, 0 } |
| }; |
| static int nlocustab = (sizeof(locustab) / sizeof(struct keytab)); |
| |
| #endif /* LOCUS */ |
| |
| #ifndef NOCSETS |
| /* SET TRANSFER CHARACTER-SET table */ |
| |
| extern struct keytab tcstab[]; |
| extern int ntcs; |
| #endif /* NOCSETS */ |
| |
| /* SET TRANSFER LOCKING-SHIFT table */ |
| struct keytab lstab[] = { |
| "forced", 2, 0, |
| "off", 0, 0, |
| "on", 1, 0 |
| }; |
| int nls = (sizeof(lstab) / sizeof(struct keytab)); |
| |
| /* SET TELNET tables */ |
| #ifdef TNCODE |
| extern int tn_nlm, tn_b_nlm, tn_b_meu, tn_b_ume, tn_b_xfer, tn_sb_bug; |
| extern int tn_no_encrypt_xfer, tn_auth_krb5_des_bug; |
| extern int tn_wait_flg, tn_duplex, tn_delay_sb, tn_sfu; |
| extern int sl_tn_saved; |
| extern int tn_infinite; |
| extern int tn_rem_echo; |
| extern int tn_deb; |
| extern int tn_auth_how; |
| extern int tn_auth_enc; |
| #ifdef CK_FORWARD_X |
| extern char * tn_fwdx_xauthority; |
| #endif /* CK_FORWARD_X */ |
| #ifdef CK_AUTHENTICATION |
| static struct keytab setauth[] = { |
| #ifdef CK_KERBEROS |
| "k4", AUTH_KRB4, CM_INV, |
| "k5", AUTH_KRB5, CM_INV, |
| "kerberos4", AUTH_KRB4, 0, |
| "kerberos5", AUTH_KRB5, 0, |
| "kerberos_iv",AUTH_KRB4, CM_INV, |
| "kerberos_v", AUTH_KRB5, CM_INV, |
| "krb4", AUTH_KRB4, CM_INV, |
| "krb5", AUTH_KRB5, CM_INV, |
| #endif /* CK_KERBEROS */ |
| #ifdef CK_SRP |
| "srp", AUTH_SRP, 0, |
| #endif /* CK_SRP */ |
| #ifdef CK_SSL |
| "ssl", AUTH_SSL, 0, |
| "tls", AUTH_TLS, 0, |
| #endif /* CK_SSL */ |
| "", 0, 0 |
| }; |
| static int nsetauth = sizeof(setauth)/sizeof(struct keytab) - 1; |
| #ifdef CK_KERBEROS |
| extern char * krb5_d_principal; /* Default principal */ |
| extern char * krb5_d_instance; |
| extern char * krb5_d_realm; /* Default realm */ |
| extern char * krb5_d_cc; /* Default credentials cache */ |
| extern char * krb5_d_srv; /* Default service name */ |
| extern int krb5_d_lifetime; /* Default lifetime */ |
| extern int krb5_d_forwardable; |
| extern int krb5_d_proxiable; |
| extern int krb5_d_renewable; |
| extern int krb5_autoget; |
| extern int krb5_autodel; |
| extern int krb5_d_getk4; |
| extern int krb5_checkaddrs; /* Check TGT Addrs */ |
| extern int krb5_d_no_addresses; |
| extern char * krb5_d_addrs[]; |
| extern char * k5_keytab; /* Keytab file */ |
| |
| extern struct krb4_init_data krb4_init; |
| extern char * krb4_d_principal; /* Default principal */ |
| extern char * krb4_d_realm; /* Default realm */ |
| extern char * krb4_d_srv; /* Default service name */ |
| extern int krb4_d_lifetime; /* Default lifetime */ |
| extern int krb4_d_preauth; |
| extern char * krb4_d_instance; |
| extern int krb4_autoget; |
| extern int krb4_autodel; |
| extern int krb4_checkaddrs; /* Check TGT Addrs */ |
| extern char * k4_keytab; /* Keytab file */ |
| #ifdef KRB4 |
| extern int k4debug; |
| #endif /* KRB4 */ |
| static struct keytab krbver[] = { |
| "4", 4, 0, |
| "5", 5, 0, |
| "iv", 4, CM_INV, |
| "v", 5, CM_INV |
| }; |
| static int nkrbver = sizeof(krbver)/sizeof(struct keytab); |
| |
| static struct keytab kdestab[] = { |
| "never", KRB_DEL_NO, 0, |
| "no", KRB_DEL_NO, CM_INV, |
| "on-close", KRB_DEL_CL, 0, |
| "on-exit", KRB_DEL_EX, 0 |
| }; |
| static int nkdestab = sizeof(kdestab)/sizeof(struct keytab); |
| |
| static struct keytab k4tab[] = { |
| "autodel", XYKRBDEL, CM_INV, |
| "autodestroy", XYKRBDEL, 0, |
| "autoget", XYKRBGET, 0, |
| "check-address", XYKRBADR, 0, |
| "debug", XYKRBDBG, CM_INV, |
| "instance", XYKRBINS, 0, |
| "keytab", XYKRBKTB, 0, |
| "lifetime", XYKRBLIF, 0, |
| "preauth", XYKRBPRE, 0, |
| "principal", XYKRBPR, 0, |
| "prompt", XYKRBPRM, 0, |
| "realm", XYKRBRL, 0, |
| "service-name", XYKRBSRV, 0 |
| }; |
| static int nk4tab = sizeof(k4tab)/sizeof(struct keytab); |
| |
| static struct keytab k5tab[] = { |
| "addresses", XYKRBADD, 0, |
| "autodelete", XYKRBDEL, CM_INV, |
| "autodestroy", XYKRBDEL, 0, |
| "autoget", XYKRBGET, 0, |
| "cc", XYKRBCC, CM_INV, |
| "check-address", XYKRBADR, 0, |
| "credentials-cache", XYKRBCC, 0, |
| "forwardable", XYKRBFWD, 0, |
| "get-k4-tgt", XYKRBK5K4,0, |
| "instance", XYKRBINS, 0, |
| "keytab", XYKRBKTB, 0, |
| "lifetime", XYKRBLIF, 0, |
| "no-addresses", XYKRBNAD, 0, |
| "principal", XYKRBPR, 0, |
| "prompt", XYKRBPRM, 0, |
| "proxiable", XYKRBPRX, 0, |
| "realm", XYKRBRL, 0, |
| "renewable", XYKRBRNW, 0, |
| "service-name", XYKRBSRV, 0 |
| }; |
| static int nk5tab = sizeof(k5tab)/sizeof(struct keytab); |
| |
| #define KRB_PW_PRM 1 |
| #define KRB_PR_PRM 2 |
| |
| static struct keytab krbprmtab[] = { |
| "password", KRB_PW_PRM, 0, |
| "principal", KRB_PR_PRM, 0 |
| }; |
| |
| #endif /* CK_KERBEROS */ |
| #ifdef CK_SRP |
| static struct keytab srptab[] = { |
| "prompt", XYSRPPRM, 0 |
| }; |
| static int nsrptab = sizeof(srptab)/sizeof(struct keytab); |
| #define SRP_PW_PRM 1 |
| |
| static struct keytab srpprmtab[] = { |
| "password", SRP_PW_PRM, 0 |
| }; |
| #endif /* CK_SRP */ |
| #ifdef CK_SSL |
| static struct keytab ssltab[] = { |
| "certs-ok", XYSSLCOK, CM_INV, |
| "cipher-list", XYSSLCL, 0, |
| "crl-dir", XYSSLCRLD, 0, |
| "crl-file", XYSSLCRL, 0, |
| "debug", XYSSLDBG, 0, |
| "dh-key-file", XYSSLDKFL, CM_INV, |
| "dh-param-file", XYSSLDPFL, 0, |
| "dsa-cert-chain-file", XYSSLDCCF, 0, |
| "dsa-cert-file", XYSSLDCFL, 0, |
| "dsa-key-file", XYSSLDKFL, 0, |
| "dummy", XYSSLDUM, CM_INV, |
| "only", XYSSLON, CM_INV, |
| "random-file", XYSSLRND, 0, |
| "rsa-cert-chain-file", XYSSLRCCF, 0, |
| "rsa-cert-file", XYSSLRCFL, 0, |
| "rsa-key-file", XYSSLRKFL, 0, |
| "verbose", XYSSLVRB, 0, |
| "verify", XYSSLVRF, 0, |
| "verify-dir", XYSSLVRFD, 0, |
| "verify-file", XYSSLVRFF, 0 |
| }; |
| static int nssltab = sizeof(ssltab)/sizeof(struct keytab); |
| static struct keytab sslvertab[] = { |
| "fail-if-no-peer-cert", SSL_VERIFY_PEER | |
| SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0, |
| "no", SSL_VERIFY_NONE, 0, |
| "none", SSL_VERIFY_NONE, CM_INV, |
| "off", SSL_VERIFY_NONE, CM_INV, |
| "on", SSL_VERIFY_PEER, CM_INV, |
| "peer-cert", SSL_VERIFY_PEER, 0 |
| }; |
| static int nsslvertab = sizeof(sslvertab)/sizeof(struct keytab); |
| #endif /* CK_SSL */ |
| #endif /* CK_AUTHENTICATION */ |
| #ifdef CK_ENCRYPTION |
| int cx_type = CX_AUTO; |
| extern int sl_cx_type; |
| #endif /* CK_ENCRYPTION */ |
| extern char *tcp_address; |
| #ifndef NOHTTP |
| extern char * tcp_http_proxy; |
| extern char * tcp_http_proxy_user; |
| extern char * tcp_http_proxy_pwd; |
| extern char * tcp_http_proxy_agent; |
| #endif /* NOHTTP */ |
| #ifdef NT |
| #ifdef CK_SOCKS |
| extern char *tcp_socks_svr; |
| extern char *tcp_socks_user; |
| #ifdef CK_SOCKS_NS |
| extern char *tcp_socks_ns; |
| #endif /* CK_SOCKS_NS */ |
| #endif /* CK_SOCKS */ |
| #endif /* NT */ |
| |
| #define UPW_USER 1 |
| #define UPW_PASS 2 |
| #define UPW_AGENT 3 |
| |
| static struct keytab userpass[] = { |
| { "/agent", UPW_AGENT, CM_ARG }, |
| { "/password", UPW_PASS, CM_ARG }, |
| { "/user", UPW_USER, CM_ARG }, |
| }; |
| static int nuserpass = sizeof(userpass)/sizeof(struct keytab); |
| |
| static struct keytab tnnegtab[] = { /* TELNET NEGOTIATION table */ |
| "accepted", TN_NG_AC, 0, |
| "refused", TN_NG_RF, 0, |
| "req", TN_NG_RQ, CM_INV|CM_ABR, |
| "requ", TN_NG_RQ, CM_INV|CM_ABR, |
| "reque", TN_NG_RQ, CM_INV|CM_ABR, |
| "reques", TN_NG_RQ, CM_INV|CM_ABR, |
| "request", TN_NG_RQ, CM_INV|CM_ABR, |
| "requeste", TN_NG_RQ, CM_INV|CM_ABR, |
| "requested", TN_NG_RQ, 0, |
| "required", TN_NG_MU, 0 |
| }; |
| static int ntnnegtab = sizeof(tnnegtab)/sizeof(struct keytab); |
| |
| #ifdef CK_ENCRYPTION |
| static struct keytab typkwd[] = { |
| "/type", 0, CM_ARG |
| }; |
| |
| static struct keytab tnenctab[] = { /* TELNET ENCRYPTION table */ |
| "accepted", TN_NG_AC, CM_INV, |
| "refused", TN_NG_RF, CM_INV, |
| "req", TN_NG_RQ, CM_INV|CM_ABR, |
| "requ", TN_NG_RQ, CM_INV|CM_ABR, |
| "reque", TN_NG_RQ, CM_INV|CM_ABR, |
| "reques", TN_NG_RQ, CM_INV|CM_ABR, |
| "request", TN_NG_RQ, CM_INV|CM_ABR, |
| "requeste", TN_NG_RQ, CM_INV|CM_ABR, |
| "requested", TN_NG_RQ, CM_INV, |
| "required", TN_NG_MU, CM_INV, |
| "start", TN_EN_START, CM_INV, |
| "stop", TN_EN_STOP, CM_INV, |
| "type", TN_EN_TYP, 0 |
| }; |
| static int ntnenc = sizeof(tnenctab)/sizeof(struct keytab) ; |
| #endif /* CK_ENCRYPTION */ |
| |
| #ifdef CK_FORWARD_X |
| static struct keytab tnfwdxtab[] = { /* TELNET FORWARD-X table */ |
| "no-encryption", 1, CM_INV, |
| "xauthority-file", 0, 0 |
| }; |
| static int ntnfwdx = sizeof(tnfwdxtab)/sizeof(struct keytab) ; |
| #endif /* CK_FORWARD_X */ |
| |
| static struct keytab tnbugtab[] = { /* TELNET BUG table */ |
| "auth-krb5-des", 4, 0, |
| "binary-me-means-u-too", 0, 0, |
| "binary-u-means-me-too", 1, 0, |
| "infinite-loop-check", 2, 0, |
| "sb-implies-will-do", 3, 0 |
| }; |
| |
| #ifdef CK_ENVIRONMENT |
| static struct keytab tnenvtab[] = { /* TELNET ENVIRONMENT table */ |
| "acct", TN_ENV_ACCT, 0, |
| "display", TN_ENV_DISP, 0, |
| "job", TN_ENV_JOB, 0, |
| "location", TN_ENV_LOC, 0, |
| "off", TN_ENV_OFF, CM_INV, |
| "on", TN_ENV_ON, CM_INV, |
| "printer", TN_ENV_PRNT, 0, |
| "systemtype",TN_ENV_SYS, 0, |
| "user", TN_ENV_USR, 0, |
| "uservar", TN_ENV_UVAR, 0, |
| "", 0, 0 |
| }; |
| static int ntnenv = sizeof(tnenvtab)/sizeof(struct keytab) - 1; |
| #endif /* CK_ENVIRONMENT */ |
| |
| #ifdef CK_AUTHENTICATION |
| static struct keytab tnauthtab[] = { /* TELNET AUTHENTICATION table */ |
| "accepted", TN_NG_AC, CM_INV, |
| "encrypt-flag", TN_AU_ENC, 0, |
| "forwarding", TN_AU_FWD, 0, |
| "how-flag", TN_AU_HOW, 0, |
| "refused", TN_NG_RF, CM_INV, |
| "req", TN_NG_RQ, CM_INV|CM_ABR, |
| "requ", TN_NG_RQ, CM_INV|CM_ABR, |
| "reque", TN_NG_RQ, CM_INV|CM_ABR, |
| "reques", TN_NG_RQ, CM_INV|CM_ABR, |
| "request", TN_NG_RQ, CM_INV|CM_ABR, |
| "requeste", TN_NG_RQ, CM_INV|CM_ABR, |
| "requested", TN_NG_RQ, CM_INV, |
| "required", TN_NG_MU, CM_INV, |
| "type", TN_AU_TYP, 0 |
| }; |
| static int ntnauth = sizeof(tnauthtab)/sizeof(struct keytab) ; |
| |
| struct keytab autyptab[] = { /* TELNET AUTHENTICATION TYPE table */ |
| "automatic", AUTH_AUTO, 0, |
| #ifdef CK_KERBEROS |
| "k4", AUTH_KRB4, CM_INV, |
| "k5", AUTH_KRB5, CM_INV, |
| "kerberos4", AUTH_KRB4, 0, |
| "kerberos5", AUTH_KRB5, 0, |
| "kerberos_iv",AUTH_KRB4, CM_INV, |
| "kerberos_v", AUTH_KRB5, CM_INV, |
| "krb4", AUTH_KRB4, CM_INV, |
| "krb5", AUTH_KRB5, CM_INV, |
| #endif /* CK_KERBEROS */ |
| "none", AUTH_NONE, 0, |
| #ifdef NT |
| "ntlm", AUTH_NTLM, 0, |
| #endif /* NT */ |
| #ifdef CK_SRP |
| "srp", AUTH_SRP, 0, |
| #endif /* CK_SRP */ |
| #ifdef CK_SSL |
| "ssl", AUTH_SSL, 0, |
| #endif /* CK_SSL */ |
| "", 0, 0 |
| }; |
| int nautyp = sizeof(autyptab)/sizeof(struct keytab) - 1; |
| |
| struct keytab auhowtab[] = { /* TELNET AUTHENTICATION HOW table */ |
| "any", TN_AUTH_HOW_ANY, 0, |
| "mutual", TN_AUTH_HOW_MUTUAL, 0, |
| "one-way", TN_AUTH_HOW_ONE_WAY, 0, |
| "", 0, 0 |
| }; |
| int nauhow = sizeof(auhowtab)/sizeof(struct keytab) - 1; |
| |
| struct keytab auenctab[] = { /* TELNET AUTHENTICATION ENCRYPT table */ |
| "any", TN_AUTH_ENC_ANY, 0, |
| "none", TN_AUTH_ENC_NONE, 0, |
| "telopt", TN_AUTH_ENC_TELOPT, 0, |
| #ifdef CK_SSL |
| "tls", TN_AUTH_ENC_TLS, 0, |
| #endif /* CK_SSL */ |
| "", 0, 0 |
| }; |
| int nauenc = sizeof(auenctab)/sizeof(struct keytab) - 1; |
| #endif /* CK_AUTHENTICATION */ |
| |
| #define TN_NL_BIN 3 |
| #define TN_NL_NVT 4 |
| static struct keytab tn_nlmtab[] = { /* TELNET NEWLINE-MODE table */ |
| "binary-mode", TN_NL_BIN, 0, /* Binary mode */ |
| "nvt", TN_NL_NVT, 0, /* NVT mode */ |
| "off", TNL_CRNUL, CM_INV, /* CR-NUL (TELNET spec) */ |
| "on", TNL_CRLF, CM_INV, /* CR-LF (TELNET spec) */ |
| "raw", TNL_CR, CM_INV /* CR only (out of spec) */ |
| }; |
| static int ntn_nlm = (sizeof(tn_nlmtab) / sizeof(struct keytab)); |
| |
| static struct keytab tnlmtab[] = { /* TELNET NEWLINE-MODE table */ |
| "cr", TNL_CR, CM_INV, /* CR only (out of spec) */ |
| "cr-lf", TNL_CRLF, CM_INV, /* CR-LF (TELNET spec) */ |
| "cr-nul", TNL_CRNUL, CM_INV, /* CR-NUL (TELNET spec) */ |
| "lf", TNL_LF, CM_INV, /* LF instead of CR-LF */ |
| "off", TNL_CRNUL, 0, /* CR-NUL (TELNET spec) */ |
| "on", TNL_CRLF, 0, /* CR-LF (TELNET spec) */ |
| "raw", TNL_CR, 0 /* CR only (out of spec) */ |
| }; |
| static int ntnlm = (sizeof(tnlmtab) / sizeof(struct keytab)); |
| |
| struct keytab tntab[] = { |
| #ifdef CK_AUTHENTICATION |
| "authentication", CK_TN_AU, 0, |
| #endif /* CK_AUTHENTICATION */ |
| "b", CK_TN_BM, CM_INV|CM_ABR, |
| "bi", CK_TN_BM, CM_INV|CM_ABR, |
| "bin", CK_TN_BM, CM_INV|CM_ABR, |
| "bina", CK_TN_BM, CM_INV|CM_ABR, |
| "binar", CK_TN_BM, CM_INV|CM_ABR, |
| "binary", CK_TN_BM, CM_INV|CM_ABR, |
| "binary-", CK_TN_BM, CM_INV|CM_ABR, |
| "binary-mode", CK_TN_BM, CM_INV, |
| "binary-transfer-mode", CK_TN_XF, 0, |
| "binary-xfer-mode", CK_TN_XF, CM_INV, |
| "bug", CK_TN_BUG, 0, |
| "debug", CK_TN_DB, 0, |
| "delay-sb", CK_TN_DL, 0, |
| "echo", CK_TN_EC, 0, |
| #ifdef CK_ENCRYPTION |
| "encryption", CK_TN_ENC, 0, |
| #endif /* CK_ENCRYPTION */ |
| #ifdef CK_ENVIRONMENT |
| "environment", CK_TN_ENV, 0, |
| #endif /* CK_ENVIRONMENT */ |
| #ifdef CK_FORWARD_X |
| "forward-x", CK_TN_FX, 0, |
| #endif /* CK_FORWARD_X */ |
| #ifdef IKS_OPTION |
| "kermit", CK_TN_IKS, CM_INV, |
| #endif /* IKS_OPTION */ |
| #ifdef CK_SNDLOC |
| "location", CK_TN_LOC, 0, |
| #endif /* CK_SNDLOC */ |
| #ifdef CK_NAWS |
| "naws", CK_TN_NAWS, CM_INV, |
| #endif /* CK_NAWS */ |
| "newline-mode", CK_TN_NL, 0, |
| "no-encrypt-during-xfer", CK_TN_NE, CM_INV, |
| "prompt-for-userid",CK_TN_PUID,0, |
| "remote-echo", CK_TN_RE, 0, |
| #ifdef CK_SSL |
| "start-tls", CK_TN_TLS, CM_INV, |
| #endif /* CK_SSL */ |
| #ifdef NT |
| "sfu-compatibility", CK_TN_SFU, 0, |
| #else |
| "sfu-compatibility", CK_TN_SFU, CM_INV, |
| #endif /* NT */ |
| "terminal-type", CK_TN_TT, 0, |
| "wait-for-negotiations", CK_TN_WAIT, 0, |
| #ifdef CK_ENVIRONMENT |
| "xdisplay-location",CK_TN_XD, CM_INV, |
| #endif /* CK_ENVIRONMENT */ |
| "", 0, 0 |
| }; |
| int ntn = (sizeof(tntab) / sizeof(struct keytab)) - 1; |
| |
| struct keytab tnopttab[] = { |
| #ifdef CK_AUTHENTICATION |
| "authentication", CK_TN_AU, 0, |
| #else |
| "authentication", CK_TN_AU, CM_INV, |
| #endif /* CK_AUTHENTICATION */ |
| "binary-mode", CK_TN_BM, 0, |
| #ifdef TN_COMPORT |
| "c", CK_TN_CPC, CM_INV|CM_ABR, |
| "co", CK_TN_CPC, CM_INV|CM_ABR, |
| "com", CK_TN_CPC, CM_INV|CM_ABR, |
| "com-port-control",CK_TN_CPC, 0, |
| "comport-control", CK_TN_CPC, CM_INV, |
| #else /* TN_COMPORT */ |
| "com-port-control",CK_TN_CPC, CM_INV, |
| "comport-control", CK_TN_CPC, CM_INV, |
| #endif /* TN_COMPORT */ |
| "echo", CK_TN_EC, 0, |
| #ifdef CK_ENCRYPTION |
| "encryption", CK_TN_ENC, 0, |
| #else |
| "encryption", CK_TN_ENC, CM_INV, |
| #endif /* CK_ENCRYPTION */ |
| #ifdef CK_FORWARD_X |
| "forward-x", CK_TN_FX, 0, |
| #else /* CK_FORWARD_X */ |
| "forward-x", CK_TN_FX, CM_INV, |
| #endif /* CK_FORWARD_X */ |
| "ibm-sak", CK_TN_SAK, CM_INV, |
| #ifdef IKS_OPTION |
| "kermit", CK_TN_IKS, 0, |
| #else |
| "kermit", CK_TN_IKS, CM_INV, |
| #endif /* IKS_OPTION */ |
| "lflow", CK_TN_FLW, CM_INV, |
| "logout", CK_TN_LOG, 0, |
| #ifdef CK_NAWS |
| "naws", CK_TN_NAWS, 0, |
| #else |
| "naws", CK_TN_NAWS, CM_INV, |
| #endif /* CK_NAWS */ |
| #ifdef CK_ENVIRONMENT |
| "new-environment", CK_TN_ENV, 0, |
| #else |
| "new-environment", CK_TN_ENV, CM_INV, |
| #endif /* CK_ENVIRONMENT */ |
| "pragma-heartbeat",CK_TN_PHR, CM_INV, |
| "pragma-logon", CK_TN_PLG, CM_INV, |
| "pragma-sspi", CK_TN_PSP, CM_INV, |
| "sak", CK_TN_SAK, CM_INV, |
| #ifdef CK_SNDLOC |
| "send-location", CK_TN_LOC, 0, |
| #else |
| "send-location", CK_TN_LOC, CM_INV, |
| #endif /* CK_SNDLOC */ |
| "sga", CK_TN_SGA, CM_INV|CM_ABR, |
| #ifdef CK_SSL |
| "start-tls", CK_TN_TLS, 0, |
| #else |
| "start-tls", CK_TN_TLS, CM_INV, |
| #endif /* CK_SSL */ |
| "suppress-go-aheads", CK_TN_SGA, 0, |
| "terminal-type", CK_TN_TT, 0, |
| "ttype", CK_TN_TT, CM_INV|CM_ABR, |
| #ifdef CK_ENVIRONMENT |
| "xdisplay-location", CK_TN_XD, 0, |
| #else |
| "xdisplay-location", CK_TN_XD, CM_INV, |
| #endif /* CK_ENVIRONMENT */ |
| "", 0, 0 |
| }; |
| int ntnopt = (sizeof(tnopttab) / sizeof(struct keytab)) - 1; |
| |
| struct keytab tnoptsw[] = { |
| "/client", CK_TN_CLIENT, 0, |
| "/server", CK_TN_SERVER, 0 |
| }; |
| int ntnoptsw = (sizeof(tnoptsw) / sizeof(struct keytab)); |
| #endif /* TNCODE */ |
| |
| struct keytab ftrtab[] = { /* Feature table */ |
| #ifndef NOCSETS /* 0 = we have it, 1 = we don't */ |
| "character-sets", 0, 0, |
| #else |
| "character-sets", 1, 0, |
| #endif /* NOCSETS */ |
| #ifndef NOCYRIL |
| "cyrillic", 0, 0, |
| #else |
| "cyrillic", 1, 0, |
| #endif /* NOCYRIL */ |
| |
| #ifndef NOLOGDIAL |
| "cx-log", 0, 0, |
| #else |
| "cx-log", 1, 0, |
| #endif /* NOLOGDIAL */ |
| |
| #ifndef NODEBUG |
| "debug", 0, 0, |
| #else |
| "debug", 1, 0, |
| #endif /* NODEBUG */ |
| |
| #ifndef NODIAL |
| "dial", 0, 0, |
| #else |
| "dial", 1, 0, |
| #endif /* NODIAL */ |
| |
| #ifdef DYNAMIC |
| "dynamic-memory", 0, 0, |
| #else |
| "dynamic-memory", 1, 0, |
| #endif /* DYNAMIC */ |
| |
| #ifndef NOXFER |
| "file-transfer", 0, 0, |
| #else |
| "file-transfer", 1, 0, |
| #endif /* NOXFER */ |
| |
| #ifdef XXFWD |
| "forward", 0, 0, |
| #else |
| "forward", 1, 0, |
| #endif /* XXFWD */ |
| |
| #ifdef NEWFTP |
| "ftp", 0, 0, |
| #else |
| "ftp", 1, 0, |
| #endif /* NEWFTP */ |
| |
| #ifdef CK_CURSES |
| "fullscreen-display", 0, 0, |
| #else |
| "fullscreen-display", 1, 0, |
| #endif /* CK_CURSES */ |
| #ifdef GREEK |
| "greek", 0, 0, |
| #else |
| "greek", 1, 0, |
| #endif /* GREEK */ |
| #ifdef HEBREW |
| "hebrew", 0, 0, |
| #else |
| "hebrew", 1, 0, |
| #endif /* HEBREW */ |
| #ifndef NOHELP |
| "help", 0, 0, |
| #else |
| "help", 1, 0, |
| #endif /* NOHELP */ |
| |
| #ifndef NOIKSD |
| "iksd", 0, 0, |
| #else |
| "iksd", 1, 0, |
| #endif /* NOIKSD */ |
| |
| #ifndef NOSPL |
| "if-command", 0, 0, |
| #else |
| "if-command", 1, 0, |
| #endif /* NOSPL */ |
| #ifndef NOJC |
| #ifdef UNIX |
| "job-control", 0, 0, |
| #else |
| "job-control", 1, 0, |
| #endif /* UNIX */ |
| #else |
| "job-control", 1, 0, |
| #endif /* NOJC */ |
| #ifdef KANJI |
| "kanji", 0, 0, |
| #else |
| "kanji", 1, 0, |
| #endif /* KANJI */ |
| |
| #ifndef NOXFER |
| "kermit", 0, 0, |
| #else |
| "kermit", 1, 0, |
| #endif /* NOXFER */ |
| |
| #ifdef CK_KERBEROS |
| "kerberos", 0, 0, |
| #else |
| "kerberos", 1, 0, |
| #endif /* CK_KERBEROS */ |
| |
| #ifndef NOCSETS |
| "latin1", 0, 0, |
| #else |
| "latin1", 1, 0, |
| #endif /* NOCSETS */ |
| #ifdef LATIN2 |
| "latin2", 0, 0, |
| #else |
| "latin2", 1, 0, |
| #endif /* LATIN2 */ |
| |
| #ifdef CKLEARN |
| "learned-scripts", 0, 0, |
| #else |
| "learned-scripts", 1, 0, |
| #endif /* CKLEARN */ |
| |
| #ifndef NOLOCAL |
| "making-connections", 0, 0, |
| #else |
| "making-connections", 1, 0, |
| #endif /* NOLOCAL */ |
| |
| #ifdef NETCONN |
| "network", 0, 0, |
| #else |
| "network", 1, 0, |
| #endif /* NETCONN */ |
| |
| #ifdef NT |
| #ifdef CK_AUTHENTICATION |
| "ntlm", 1, 0, |
| #else /* CK_AUTHENTICATION */ |
| "ntlm", 0, 0, |
| #endif /* CK_AUTHENTICATION */ |
| #else /* NT */ |
| "ntlm", 0, 0, |
| #endif /* NT */ |
| |
| #ifdef PIPESEND |
| "pipes", 0, 0, |
| #else |
| #ifdef NETCMD |
| "pipes", 0, 0, |
| #endif /* NETCMD */ |
| #endif /* PIPESEND */ |
| #ifndef PIPESEND |
| #ifndef NETCMD |
| "pipes", 1, 0, |
| #endif /* PIPESEND */ |
| #endif /* NETCMD */ |
| |
| #ifdef NETPTY |
| "pty", 0, 0, |
| #else |
| "pty", 1, 0, |
| #endif /* NETPTY */ |
| |
| #ifndef NOPUSH |
| "push", 0, 0, |
| #else |
| "push", 1, 0, |
| #endif /* PUSH */ |
| |
| #ifdef CK_REDIR |
| "redirect", 0, 0, |
| #else |
| "redirect", 1, 0, |
| #endif /* CK_REDIR */ |
| |
| #ifdef CK_RTSCTS |
| "rts/cts", 0, 0, |
| #else |
| "rts/cts", 1, 0, |
| #endif /* RTS/CTS */ |
| |
| #ifndef NOSCRIPT |
| "script-command", 0, 0, |
| #else |
| "script-command", 1, 0, |
| #endif /* NOSCRIPT */ |
| #ifndef NOSERVER |
| "server-mode", 0, 0, |
| #else |
| "server-mode", 1, 0, |
| #endif /* NOSERVER */ |
| |
| #ifndef NOSEXP |
| "sexpression", 0, 0, |
| #else |
| "sexpression", 1, 0, |
| #endif /* NOSEXP */ |
| |
| #ifdef SFTP_BUILTIN |
| "sftp", 1, 0, |
| #else |
| "sftp", 0, 0, |
| #endif /* SFTP_BUILTIN */ |
| |
| #ifndef NOSHOW |
| "show-command", 0, 0, |
| #else |
| "show-command", 1, 0, |
| #endif /* NOSHOW */ |
| |
| #ifdef CK_SRP |
| "srp", 0, 0, |
| #else |
| "srp", 1, 0, |
| #endif /* CK_SRP */ |
| |
| #ifdef SSHBUILTIN |
| "ssh", 0, 0, |
| #else /* SSHBUILTIN */ |
| "ssh", 1, 0, |
| #endif /* SSHBUILTIN */ |
| |
| #ifdef CK_SSL |
| "ssl/tls", 0, 0, |
| #else |
| "ssl/tls", 1, 0, |
| #endif /* CK_SSL */ |
| |
| #ifndef NOXMIT |
| "transmit", 0, 0, |
| #else |
| "transmit", 1, 0, |
| #endif /* NOXMIT */ |
| |
| #ifdef UNICODE |
| "unicode", 0, 0, |
| #else |
| "unicode", 1, 0, |
| #endif /* UNICODE */ |
| |
| #ifdef CK_XYZ |
| "xyzmodem", 0, 0, |
| #else |
| "xyzmodem", 1, 0, |
| #endif /* NOXMIT */ |
| |
| "", 0, 0 |
| }; |
| int nftr = (sizeof(ftrtab) / sizeof(struct keytab)) - 1; |
| |
| struct keytab desttab[] = { /* SET DESTINATION */ |
| #ifdef CALIBRATE |
| "calibrate", DEST_N, CM_INV, |
| #endif /* CALIBRATE */ |
| "disk", DEST_D, 0, |
| #ifdef CALIBRATE |
| "nowhere", DEST_N, 0, |
| #endif /* CALIBRATE */ |
| "printer", DEST_P, 0, |
| "screen", DEST_S, 0 |
| }; |
| int ndests = (sizeof(desttab) / sizeof(struct keytab)); |
| |
| #ifndef NOSPL /* Used only with script programming items... */ |
| |
| #ifndef NOSERVER /* This is just to avoid some */ |
| #define CK_PARSDIR /* "statement not reached" */ |
| #else /* complaints... */ |
| #ifndef NODIAL |
| #define CK_PARSDIR |
| #endif /* NODIAL */ |
| #endif /* NOSERVER */ |
| |
| /* |
| cx == 0 means dial directory |
| cx == 1 means network directory |
| cx == 2 means a directory path list |
| */ |
| static int |
| parsdir(cx) int cx; { |
| int i, x, y, dd; /* Workers */ |
| int nxdir; |
| char *s; |
| char ** xdir; |
| char *pp[MAXGETPATH]; /* Temporary name pointers */ |
| #ifdef ZFNQFP |
| struct zfnfp * fnp; |
| #ifdef OS2 |
| char * env; |
| char dirpath[4096]; |
| #else /* OS2 */ |
| char dirpath[1024]; /* For fully qualified filenames */ |
| #endif /* OS2 */ |
| #endif /* ZFNQFP */ |
| |
| int max = 0; /* Maximum number of things to parse */ |
| char c; |
| |
| #ifndef NODIAL |
| if (cx == 0) { /* Dialing */ |
| nxdir = ndialdir; |
| xdir = dialdir; |
| max = MAXDDIR; |
| } else |
| #ifdef NETCONN |
| if (cx == 1) { /* Network */ |
| nxdir = nnetdir; |
| xdir = netdir; |
| max = MAXDDIR; |
| } else |
| #endif /* NETCONN */ |
| #endif /* NODIAL */ |
| #ifndef NOSERVER |
| if (cx == 2) { /* GET path */ |
| nxdir = ngetpath; |
| xdir = getpath; |
| max = MAXGETPATH; |
| } else /* Called with invalid function code */ |
| #endif /* NOSERVER */ |
| return(-2); |
| |
| for (i = 0; i < MAXGETPATH; i++) /* Init these. */ |
| pp[i] = NULL; |
| |
| #ifdef CK_PARSDIR |
| dd = 0; /* Temporary name counter */ |
| while (1) { |
| if (cx != 2) { /* Dialing or Network Directory */ |
| #ifdef OS2 |
| int len; |
| char * appdata0 = NULL, * appdata1 = NULL; |
| #ifdef NT |
| env = getenv("K95PHONES"); |
| makestr(&appdata0,(char *)GetAppData(0)); |
| makestr(&appdata1,(char *)GetAppData(1)); |
| #else /* NT */ |
| env = getenv("K2PHONES"); |
| #endif /* NT */ |
| if (!env) |
| env = getenv("K95PHONES"); |
| if (!env) |
| env = ""; |
| |
| dirpath[0] = '\0'; |
| len = strlen(env) + 2*strlen(startupdir) + 2*strlen(inidir) |
| + (appdata0?2*strlen(appdata0):0) |
| + (appdata1?2*strlen(appdata1):0) |
| + 2*strlen(zhome()) + 2*strlen(exedir) + 8*strlen("PHONES/") |
| + 12; |
| if (len < 4096) /* SAFE */ |
| sprintf(dirpath, |
| "%s%s%s;%s%s;%s%s%s%s%s%s%s%s%s;%s%s;%s;%s%s", |
| /* Semicolon-separated path list */ |
| env, |
| (env[0] && env[strlen(env)-1] == ';') ? "" : ";", |
| startupdir, |
| startupdir, "PHONES/", |
| appdata1 ? appdata1 : "", |
| appdata1 ? "Kermit 95;" : "", |
| appdata1 ? appdata1 : "", |
| appdata1 ? "Kermit 95/PHONES/;" : "", |
| appdata0 ? appdata0 : "", |
| appdata0 ? "Kermit 95;" : "", |
| appdata0 ? appdata0 : "", |
| appdata0 ? "Kermit 95/PHONES/;" : "", |
| inidir, |
| inidir, "PHONES/", |
| zhome(), |
| zhome(), "PHONES/", |
| exedir, |
| exedir, "PHONES/" |
| ); |
| #ifdef NT |
| makestr(&appdata0,NULL); |
| makestr(&appdata1,NULL); |
| #endif /* NT */ |
| #else |
| #ifdef UNIX |
| y = 1024; |
| s = dirpath; |
| zzstring("\\v(home)",&s,&y); |
| #endif /* UNIX */ |
| #endif /* OS2 */ |
| y = cmifip( |
| "Names of one or more directory files, separated by spaces", |
| "",&s,&x,0, |
| #ifdef OS2ORUNIX |
| dirpath, |
| #else |
| NULL, |
| #endif /* OS2ORUNIX */ |
| xxstring |
| ); |
| } else { /* List of directory names */ |
| x = 0; |
| y = cmdir("Directory name","",&s,xxstring); |
| } |
| if (y < 0) { |
| if (y == -3) { /* EOL or user typed <CR> */ |
| if ((y = cmcfm()) < 0) return(y); |
| for (i = 0; i < max; i++) { /* Clear these */ |
| if (i < nxdir && xdir[i]) { |
| free(xdir[i]); |
| } |
| xdir[i] = (i < dd) ? pp[i] : NULL; |
| } |
| #ifndef NODIAL |
| if (cx == 0) |
| ndialdir = dd; |
| #ifdef NETCONN |
| if (cx == 1) |
| nnetdir = dd; |
| #endif /* NETCONN */ |
| #endif /* NODIAL */ |
| #ifndef NOSERVER |
| if (cx == 2) |
| ngetpath = dd; |
| #endif /* NOSERVER */ |
| return(success = 1); |
| |
| } else { /* Parse error */ |
| for (i = 0; i < dd; i++) { /* Free temp storage */ |
| if (pp[i]) free(pp[i]); /* but don't change */ |
| pp[i] = NULL; /* anything else */ |
| } |
| return(y); |
| } |
| } |
| if (x) { |
| printf("?Wildcards not allowed\n"); |
| return(-9); |
| } |
| #ifdef CK_TMPDIR |
| if (cx == 2 && !isdir(s)) { |
| printf("?Not a directory - %s\n", s); |
| return(-9); |
| } |
| #endif /* CK_TMPDIR */ |
| |
| #ifdef ZFNQFP |
| if (cx < 2) { |
| if (!isabsolute(s)) { /* If not relative get full path */ |
| if ((fnp = zfnqfp(s,TMPBUFSIZ - 1,tmpbuf))) { |
| if (fnp->fpath) |
| if ((int) strlen(fnp->fpath) > 0) |
| s = fnp->fpath; |
| } |
| } |
| } |
| #endif /* ZFNQFP */ |
| c = NUL; |
| x = strlen(s); |
| if (x > 0) /* Get last char */ |
| c = s[x-1]; |
| debug(F000,"parsdir s",s,c); |
| if ((pp[dd] = malloc(strlen(s)+2)) == NULL) { |
| printf("?Internal error - malloc\n"); |
| for (i = 0; i < dd; i++) { /* Free temp storage */ |
| if (pp[i]) free(pp[i]); |
| pp[i] = NULL; |
| } |
| return(-9); |
| } else { /* Have storage for name */ |
| strcpy(pp[dd],s); /* Copy string into new storage */ |
| debug(F111,"parsdir pp[dd] 1",pp[dd],dd); |
| #ifndef NOXFER |
| if (cx == 2) { /* If we are parsing directories */ |
| char dirsep[2]; |
| extern int myindex; /* Append directory separator if */ |
| extern struct sysdata sysidlist[]; /* it is missing... */ |
| debug(F101,"parsdir myindex","",myindex); |
| if (myindex > -1) |
| if (sysidlist[myindex].sid_unixlike) |
| if (c != sysidlist[myindex].sid_dirsep) { |
| dirsep[0] = sysidlist[myindex].sid_dirsep; |
| dirsep[1] = NUL; |
| strcat(pp[dd], (char *) dirsep); /* safe */ |
| } |
| } |
| #endif /* NOXFER */ |
| debug(F111,"parsdir pp[dd] 2",pp[dd],dd); |
| if (++dd > max) { |
| printf("?Too many directories - %d max\n", max); |
| for (i = 0; i < dd; i++) { /* Free temp storage */ |
| if (pp[i]) free(pp[i]); |
| pp[i] = NULL; |
| } |
| } |
| } |
| } |
| #endif /* CK_PARSDIR */ |
| } |
| #endif /* NOSPL */ |
| |
| #ifndef NOSERVER |
| static int |
| cklogin() { |
| int x; |
| char * s; |
| char username[LOGINLEN+1]; |
| char password[LOGINLEN+1]; |
| char account[LOGINLEN+1]; |
| extern char * x_user, * x_passwd, * x_acct; |
| extern int x_login, x_logged; |
| |
| username[0] = NUL; |
| password[0] = NUL; |
| account[0] = NUL; |
| |
| x = cmfld("username", "", &s, xxstring); |
| if (x != -3) { |
| if (x < 0) |
| return(x); |
| if ((int)strlen(s) > LOGINLEN) { |
| printf("\"%s\" - too long, %d max\n", s, LOGINLEN); |
| return(-9); |
| } |
| ckstrncpy(username,s,LOGINLEN+1); |
| x = cmfld("password", "", &s, xxstring); |
| if (x != -3) { |
| if (x < 0) |
| return(x); |
| if ((int)strlen(s) > LOGINLEN) { |
| printf("\"%s\" - too long, %d max\n", s, LOGINLEN); |
| return(-9); |
| } |
| ckstrncpy(password,s,LOGINLEN+1); |
| x = cmfld("account", "", &s, xxstring); |
| if (x != -3) { |
| if (x < 0) |
| return(x); |
| if ((int)strlen(s) > LOGINLEN) { |
| printf("\"%s\" - too long, %d max\n", s, LOGINLEN); |
| return(-9); |
| } |
| ckstrncpy(account,s,LOGINLEN+1); |
| if ((x = cmcfm()) < 0) |
| return(x); |
| } |
| } |
| } |
| makestr(&x_user,username); |
| makestr(&x_passwd,password); |
| makestr(&x_acct,account); |
| x_login = (x_user) ? 1 : 0; |
| x_logged = 0; |
| return(1); |
| } |
| #endif /* NOSERVER */ |
| |
| #ifndef NOLOCAL |
| static int |
| setdcd() { |
| int x, y, z = 0; |
| if ((y = cmkey(crrtab,ncrr,"","automatic",xxstring)) < 0) return(y); |
| if (y == CAR_ON) { |
| x = cmnum("Carrier wait timeout, seconds","0",10,&z,xxstring); |
| if (x < 0) return(x); |
| } |
| if ((x = cmcfm()) < 0) return(x); |
| carrier = ttscarr(y); |
| cdtimo = z; |
| return(1); |
| } |
| #endif /* NOLOCAL */ |
| |
| extern struct keytab yesno[]; |
| extern int nyesno; |
| |
| /* g e t y e s n o */ |
| |
| static struct keytab q0yesno[] = { /* Yes/No/Quit keyword table */ |
| "no", 0, 0, |
| "ok", 1, 0, |
| "yes", 1, 0 |
| }; |
| static int nq0yesno = (sizeof(q0yesno) / sizeof(struct keytab)); |
| |
| static struct keytab q1yesno[] = { /* Yes/No/Quit keyword table */ |
| "no", 0, 0, |
| "ok", 1, 0, |
| "quit", 2, 0, |
| "yes", 1, 0 |
| }; |
| static int nq1yesno = (sizeof(q1yesno) / sizeof(struct keytab)); |
| |
| static struct keytab q2yesno[] = { /* Yes/No/Quit keyword table */ |
| "go", 3, 0, |
| "no", 0, 0, |
| "ok", 1, 0, |
| "yes", 1, 0 |
| }; |
| static int nq2yesno = (sizeof(q2yesno) / sizeof(struct keytab)); |
| |
| static struct keytab q3yesno[] = { /* Yes/No/Quit keyword table */ |
| "go", 3, 0, |
| "no", 0, 0, |
| "ok", 1, 0, |
| "quit", 2, 0, |
| "yes", 1, 0 |
| }; |
| static int nq3yesno = (sizeof(q3yesno) / sizeof(struct keytab)); |
| |
| |
| /* Ask question, get yes/no answer */ |
| |
| int |
| getyesno(msg, flags) char * msg; int flags; { |
| #ifdef CK_RECALL |
| extern int on_recall; /* around Password prompting */ |
| #endif /* CK_RECALL */ |
| int y, z; |
| |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| extern int vmode, win95_popup, startflags; |
| int vmode_sav = vmode; |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| |
| #ifdef CK_APC |
| if ( apcactive != APC_INACTIVE && (apcstatus & APC_NOINP) ) { |
| return(success = 0); |
| } |
| #endif /* CK_APC */ |
| |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| #ifdef COMMENT |
| if (win95_popup && !(startflags & 96) |
| #ifdef IKSD |
| && !inserver |
| #endif /* IKSD */ |
| ) |
| return(popup_readyesno(vmode,NULL,msg,flags)); |
| #endif /* COMMENT */ |
| if (vmode == VTERM) { |
| vmode = VCMD; |
| VscrnIsDirty(VTERM); |
| VscrnIsDirty(VCMD); |
| } |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| #ifdef VMS |
| /* |
| In VMS, whenever a TAKE file or macro is active, we restore the |
| original console modes so Ctrl-C/Ctrl-Y can work. But here we |
| go interactive again, so we have to temporarily put them back. |
| */ |
| if (!xcmdsrc) |
| concb((char)escape); |
| #endif /* VMS */ |
| |
| #ifdef CK_RECALL |
| on_recall = 0; |
| #endif /* CK_RECALL */ |
| cmsavp(psave,PROMPTL); /* Save old prompt */ |
| cmsetp(msg); /* Make new prompt */ |
| z = 0; /* Initialize answer to No. */ |
| cmini(ckxech); /* Initialize parser. */ |
| do { |
| prompt(NULL); /* Issue prompt. */ |
| switch (flags) { |
| case 0: y = cmkey(q0yesno,nq0yesno,"","",NULL); break; |
| case 1: y = cmkey(q1yesno,nq1yesno,"","",NULL); break; |
| case 2: y = cmkey(q2yesno,nq2yesno,"","",NULL); break; |
| default: y = cmkey(q3yesno,nq3yesno,"","",NULL); |
| } |
| if (y < 0) { |
| if (y == -4) { /* EOF */ |
| z = y; |
| break; |
| } else if (y == -3) /* No answer? */ |
| printf(" Please respond; type '?' to see valid answers.\n"); |
| cmini(ckxech); |
| } else { |
| z = y; /* Save answer */ |
| y = cmcfm(); /* Get confirmation */ |
| } |
| } while (y < 0); /* Continue till done */ |
| cmsetp(psave); /* Restore real prompt */ |
| #ifdef VMS |
| if (cmdlvl > 0) /* In VMS and not at top level, */ |
| conres(); /* restore console again. */ |
| #endif /* VMS */ |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| if (vmode != vmode_sav) { |
| vmode = VTERM; |
| VscrnIsDirty(VCMD); |
| VscrnIsDirty(VTERM); |
| } |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| return(z); |
| } |
| |
| #ifdef KUI |
| extern HWND hwndConsole; |
| _PROTOTYP(int gui_txt_dialog,(char *,char *,int,char *,int,char *,int)); |
| _PROTOTYP(int gui_mtxt_dialog,(char *,int,struct txtbox [])); |
| _PROTOTYP(int gui_position,(int, int)); |
| _PROTOTYP(int gui_resize_mode,(int)); |
| _PROTOTYP(int gui_win_run_mode,(int)); |
| _PROTOTYP(int gui_saveas_dialog,(char *,char *, int, char *, char *, int)); |
| extern int gui_dialog; |
| #endif /* KUI */ |
| |
| /* u q _ o k -- User Query, get Yes/No or OK Cancel */ |
| /* |
| Call with: |
| preface: Explanatory text to print, or NULL. |
| prompt: Prompt. |
| mask: Bitmask for legal responses: 1 = OK or Yes; 2 = No or Cancel. |
| help: Help text (array of strings or NULL) [not used by parser]. |
| dflt: Default response (1 or 2) [not used by parser]. |
| Returns: |
| -1: Invalid argument(s). |
| 0: User said No or Cancel. |
| 1 User said Yes or OK. |
| Notes: |
| preface and prompt should not include final line terminator but may |
| include embedded ones. Help text is in case GUI dialog needs a Help |
| button; final element of help-string array is "". dflt is used by GUI |
| to highlight the default response button. |
| */ |
| int |
| #ifdef CK_ANSIC |
| uq_ok(char * preface, char * prompt, int mask,char ** help, int dflt) |
| #else /* CK_ANSIC */ |
| uq_ok(preface,prompt,mask,help,dflt) |
| char * preface, * prompt, ** help; |
| int mask, dflt; |
| #endif /* CK_ANSIC */ |
| /* uq_ok */ { |
| int rc, len; |
| char * text=NULL; |
| |
| if (!prompt) |
| return(-1); |
| |
| if ((mask & 3) == 1) { /* OK (GUI only) */ |
| #ifdef KUI |
| if ( gui_dialog ) { |
| /* This one is for popup help, alerts, etc */ |
| if (preface) { |
| len = strlen(preface) + strlen(prompt) + 4; |
| text = (char *)malloc(len); |
| ckmakmsg(text,len,preface,"\n",prompt,NULL); |
| } |
| rc = MessageBox(hwndConsole, |
| text ? text : prompt, |
| prompt, |
| MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); |
| ShowWindowAsync(hwndConsole,SW_SHOWNORMAL); |
| SetForegroundWindow(hwndConsole); |
| if (text) |
| free(text); |
| if (!rc) |
| return(-1); |
| else |
| return(1); |
| } else |
| #endif /* KUI */ |
| { |
| if (preface) /* Just display the text, if any */ |
| printf("%s\n",preface); |
| if (prompt) |
| printf("%s\n",prompt); |
| return(1); |
| } |
| } else if ((mask & 3) == 3) { /* Yes/No or OK/Cancel */ |
| #ifdef KUI |
| if ( gui_dialog ) { |
| if (preface) { |
| len = strlen(preface) + strlen(prompt) + 4; |
| text = (char *)malloc(len); |
| ckmakmsg(text,len,preface,"\n",prompt,NULL); |
| } |
| rc = MessageBox(hwndConsole, |
| text ? text : prompt, |
| prompt, |
| MB_YESNO | MB_ICONINFORMATION | MB_TASKMODAL | |
| (dflt == 2 ? MB_DEFBUTTON2 : MB_DEFBUTTON1)); |
| ShowWindowAsync(hwndConsole,SW_SHOWNORMAL); |
| SetForegroundWindow(hwndConsole); |
| if (text) |
| free(text); |
| if (!rc) |
| return(-1); |
| else if (rc == IDNO || rc == IDCANCEL) |
| return(0); |
| else |
| return(1); |
| } else |
| #endif /* KUI */ |
| { |
| if (preface) |
| printf("%s\n",preface); |
| return(getyesno(prompt,0)); |
| } |
| } else { |
| printf("?Internal error: uq_ok()\n"); |
| return(-1); |
| } |
| } |
| |
| /* u q _ t x t -- User Query, get single text response */ |
| /* |
| Call with: |
| preface: Explanatory text to print, or NULL. |
| prompt: Prompt. |
| echo: 0 = don't echo; 1 = echo; 2 = echo with asterisks. |
| help: Help text (array of strings or NULL) [not used by parser]. |
| buf: Pointer to result buffer. |
| buflen: Length of result buffer. |
| dflt: Default response text or NULL [not used by parser]. |
| timer: Optional Timeout |
| Returns: |
| 0: User said No or Cancel. |
| 1 User said Yes or OK. |
| Notes: |
| preface, prompt, and help as for uq_ok(). |
| */ |
| int |
| #ifdef CK_ANSIC |
| uq_txt(char * preface, char * prompt, int echo, char ** help, char * buf, |
| int buflen, char *dflt, int timer) |
| #else /* CK_ANSIC */ |
| uq_txt(preface,prompt,echo,help,buf,buflen,dflt,timer) |
| char * preface, * prompt, ** help, * buf, * dflt; |
| int buflen, echo, timer; |
| #endif /* CK_ANSIC */ |
| { |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| extern int vmode; |
| extern int startflags; |
| extern int win95_popup; |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| int rc; |
| |
| if (buflen < 1 || !buf) |
| return(0); |
| #ifdef KUI |
| if ( gui_dialog ) { |
| rc = gui_txt_dialog(preface,prompt,echo,buf,buflen,dflt,timer); |
| if ( rc > -1 ) |
| return(rc); |
| /* Otherwise, the dialog could not be created. Fallback to text mode */ |
| } |
| #endif /* KUI */ |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| if (win95_popup && !(startflags & 96) |
| #ifdef IKSD |
| && !inserver |
| #endif /* IKSD */ |
| ) { |
| debok = 0; /* Don't log */ |
| if (echo == 1) |
| popup_readtext(vmode,preface,prompt,buf,buflen,0); |
| else |
| popup_readpass(vmode,preface,prompt,buf,buflen,0); |
| debok = 1; |
| return(1); |
| } |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| |
| if (preface) |
| printf("%s\n",preface); |
| if (echo == 1) |
| readtext(prompt,buf,buflen); |
| else |
| readpass(prompt,buf,buflen); |
| return(1); /* (no buttons in parser) */ |
| } |
| |
| /* u q _ m t x t -- User Query, get multiple text responses */ |
| /* |
| Call with: |
| preface: Explanatory text to print, or NULL. |
| help: Help text (array of strings or NULL) [not used by parser]. |
| n: Number of responses wanted. |
| field: Array of struct txtbox, one element per field, see ckuusr.h. |
| Returns: |
| 0: User said No or Cancel. |
| 1 User said Yes or OK. |
| Notes: |
| preface and help as for uq_ok(). |
| */ |
| int |
| #ifdef CK_ANSIC |
| uq_mtxt(char * preface,char **help, int n, struct txtbox field[]) |
| #else /* CK_ANSIC */ |
| uq_mtxt(preface,help,n,field) |
| char * preface; char ** help; int n; struct txtbox field[]; |
| #endif /* CK_ANSIC */ |
| { |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| extern int vmode; |
| extern int startflags; |
| extern int win95_popup; |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| int i, rc; |
| |
| if (n < 1 || !field) |
| return(0); |
| #ifdef KUI |
| if ( gui_dialog ) { |
| rc = gui_mtxt_dialog(preface, n, field); |
| if ( rc > -1 ) |
| return(rc); |
| /* Otherwise, the dialog could not be created. Fallback to text mode */ |
| } |
| #endif /* KUI */ |
| #ifndef NOLOCAL |
| #ifdef OS2 |
| if (win95_popup && !(startflags & 96) |
| #ifdef IKSD |
| && !inserver |
| #endif /* IKSD */ |
| ) { |
| debok = 0; /* Don't log */ |
| for (i = 0; i < n; i++) { |
| if (field[i].t_echo == 1) |
| popup_readtext(vmode,preface,field[i].t_lbl,field[i].t_buf,field[i].t_len,0); |
| else |
| popup_readpass(vmode,preface,field[i].t_lbl,field[i].t_buf,field[i].t_len,0); |
| } |
| debok = 1; |
| return(1); |
| } |
| #endif /* OS2 */ |
| #endif /* NOLOCAL */ |
| |
| if (preface) |
| printf("%s\n",preface); |
| for (i = 0; i < n; i++) { |
| if (field[i].t_echo == 1) |
| readtext(field[i].t_lbl,field[i].t_buf,field[i].t_len); |
| else |
| readpass(field[i].t_lbl,field[i].t_buf,field[i].t_len); |
| } |
| return(1); |
| } |
| |
| /* u q _ f i l e -- User Query, get file or directory name */ |
| /* |
| Call with: |
| preface: Explanatory text to print, or NULL. |
| prompt: Prompt string. |
| fc: Function code: |
| 1 = input (existing) file |
| 2 = existing directory |
| 3 = create new output file |
| 4 = output file allowing append access |
| help: Help text (array of strings or NULL) [not used by parser]. |
| dflt: Default response. |
| result: Pointer to result buffer. |
| rlength: Length of result buffer. |
| |
| Returns: |
| -1: Invalid argument, result too long, or other error. |
| 0: User Canceled. |
| 1: OK, with file/pathname copied to result buffer. |
| 2: Like 1, but for output file that is to be appended to. |
| |
| Notes: |
| 1. preface and prompt should not include final line terminator but may |
| include embedded ones. Help text is in case GUI dialog needs a Help |
| button; final element of help-string array is "". |
| |
| 2. The default might be a filename, a directory name, a relative |
| pathname, or an absolute pathname. This routine must convert it into |
| into a fully qualified (absolute) pathname so the user knows exactly |
| where the file is to be found or stored. In addition, the Windows |
| version of this routine must separate the directory part from the |
| name part, so it can display the given directory in the file dialog, |
| and put name in the filename box to be edited, replaced, or |
| accepted. |
| |
| 3. When called with FC 4, the Windows version should include "New" and |
| "Append" buttons in the dialog. so the user can say whether the file |
| should overwrite any file of the same name, or be appended to it. |
| */ |
| |
| int |
| #ifdef CK_ANSIC |
| uq_file(char * preface, char * fprompt, int fc, char ** help, |
| char * dflt, char * result, int rlength) |
| #else /* CK_ANSIC */ |
| uq_file(preface,fprompt,fc,help,dflt,result,rlength) |
| char * preface, * fprompt, ** help, * dflt, * result; |
| int fc, rlength; |
| #endif /* CK_ANSIC */ |
| /* uq_file */ { |
| |
| int rc = -1, x, y, z; |
| char * s, * p, * fullpath; |
| char filebuf[CKMAXPATH+1]; |
| |
| #ifdef CK_RECALL |
| extern int on_recall; |
| #endif /* CK_RECALL */ |
| |
| #ifdef KUI |
| if ( gui_dialog ) { |
| rc = gui_saveas_dialog(preface,fprompt,fc,dflt,result,rlength); |
| return rc; |
| } |
| #endif /* KUI */ |
| |
| #ifdef CK_RECALL |
| on_recall = 0; |
| #endif /* CK_RECALL */ |
| |
| if (preface) /* If prefatory text given... */ |
| printf("%s\n",preface); /* display it. */ |
| |
| cmsavp(psave,PROMPTL); /* Save old prompt */ |
| |
| /* We get the full pathname of the proposed output file just so */ |
| /* we can show it to the user but we don't use it ourselves. */ |
| |
| p = NULL; /* Build new prompt */ |
| if (!dflt) dflt = ""; |
| if (*dflt) /* Have default filename */ |
| zfnqfp(dflt,CKMAXPATH+1,filebuf); /* Get full path */ |
| else |
| ckmakmsg(filebuf,CKMAXPATH+1,zgtdir(),"newfile",NULL,NULL); |
| fullpath = filebuf; |
| x = strlen(fullpath); |
| |
| /* If no prompt given, build one that shows the proposed full pathname. */ |
| |
| if (!fprompt) fprompt = ""; |
| if (!*fprompt) fprompt = x ? " Filename" : " Filename: "; |
| y = strlen(fprompt); |
| if (x > 0) { /* Have default pathname? */ |
| p = (char *)malloc(x + y + 7); /* Get temp storage */ |
| if (p) { /* Build prompt */ |
| ckmakmsg(p,x+y+7,fprompt," [",fullpath,"]: "); |
| fprompt = p; |
| } |
| } |
| cmsetp(fprompt); /* Make new prompt */ |
| if (p) free(p); /* Free temp storage */ |
| cmini(ckxech); /* Initialize parser. */ |
| x = -1; |
| do { |
| prompt(NULL); /* Issue prompt. */ |
| switch (fc) { /* Parse depends on function code */ |
| case 1: /* Input file */ |
| x = cmifi("Name of existing file",dflt,&s,&y,xxstring); |
| rc = 1; |
| break; |
|