ckuus5.c
资源名称:cku197.tar.Z [点击查看]
上传用户:dufan58
上传日期:2007-01-05
资源大小:3407k
文件大小:266k
源码类别:
通讯/手机编程
开发平台:
Windows_Unix
- int
- addmac(nam,def) char *nam, *def; { /* Add a macro to the macro table */
- int i, x, y, z, namlen, deflen;
- char * p = NULL, c;
- extern int tra_asg; int tra_tmp;
- if (!nam) return(-1);
- namlen = (int)strlen(nam); /* Get argument lengths */
- tra_tmp = tra_asg;
- debug(F111,"addmac nam",nam,namlen);
- if (!def) { /* Watch out for null pointer */
- deflen = 0;
- debug(F111,"addmac def","(null pointer)",deflen);
- } else {
- deflen = (int)strlen(def);
- debug(F111,"addmac def",def,deflen);
- }
- if (deflen < 0) return(-1); /* strlen() failure, fail. */
- if (namlen < 1) return(-1); /* No name given, fail. */
- if (*nam == CMDQ) nam++; /* Backslash quote? */
- if (*nam == '%') { /* Yes, if it's a variable name, */
- tra_asg = 0;
- delmac(nam); /* Delete any old value. */
- tra_asg = tra_tmp;
- if (!(c = *(nam + 1))) return(-1); /* Variable name letter or digit */
- if (deflen < 1) { /* Null definition */
- p = NULL; /* Better not malloc or strcpy! */
- } else { /* A substantial definition */
- p = malloc(deflen + 1); /* Allocate space for it */
- if (!p) {
- printf("?addmac malloc error 2n");
- return(-1);
- } else strcpy(p,def); /* Copy definition into new space */
- }
- /* Now p points to the definition, or is a null pointer */
- if (c >= '0' && c <= '9') { /* Digit variable */
- if (maclvl < 0) { /* Are we calling or in a macro? */
- g_var[c] = p; /* No, it's a global "top level" one */
- debug(F101,"addmac numeric global maclvl","",maclvl);
- makestr(&(toparg[c - '0']),p);
- } else { /* Yes, it's a macro argument */
- m_arg[maclvl][c - '0'] = p; /* Assign the value */
- debug(F101,"addmac macro arg maclvl","",maclvl);
- makestr(&(m_xarg[maclvl][c - '0']),p); /* And a copy here */
- }
- } else { /* It's a global variable */
- if (c < 33 || c > GVARS) return(-1);
- if (isupper(c)) c = (char) tolower(c);
- g_var[c] = p; /* Put pointer in global-var table */
- debug(F100,"addmac global","",0);
- }
- if (tra_asg) traceval(nam,p);
- return(0);
- } else if (*nam == '&') { /* An array reference? */
- char **q;
- debug(F110,"addmac array",nam,0);
- if ((y = arraynam(nam,&x,&z)) < 0) /* If syntax is bad */
- return(-1); /* return -1. */
- if (chkarray(x,z) < 0) /* If array not declared or */
- return(-2); /* subscript out of range, ret -2 */
- tra_asg = 0;
- delmac(nam); /* Delete any old value. */
- tra_asg = tra_tmp;
- x -= ARRAYBASE; /* Convert name letter to index. */
- if ((q = a_ptr[x]) == NULL) /* If array not declared, */
- return(-3); /* return -3. */
- if (deflen > 0) {
- if ((p = malloc(deflen+1)) == NULL) { /* Allocate space */
- printf("addmac macro error 7: %sn",nam);
- return(-4); /* for new def, return -4 on fail. */
- }
- strcpy(p,def); /* Copy definition into new space. */
- } else p = NULL;
- q[z] = p; /* Store pointer to it. */
- debug(F110,"addmac array val",p,0);
- if (tra_asg) traceval(nam,p);
- return(0); /* Done. */
- }
- debug(F110,"addmac macro def",nam,0);
- /* Not a macro argument or a variable, so it's a macro definition */
- y = isaa(nam); /* If it's not an associative array */
- debug(F111,"addmac isaa",nam,y);
- x = y ? mxxlook(mactab,nam,nmac) : mxlook(mactab,nam,nmac);
- if (x > -1) {
- tra_asg = 0;
- delmac(nam); /* If it's there, delete it. */
- tra_asg = tra_tmp;
- }
- if (deflen < 1) {
- if (tra_asg) traceval(nam,p);
- return(0);
- }
- debug(F111,"addmac table size",nam,nmac);
- for (y = 0; /* Find the alphabetical slot */
- y < MAC_MAX && mactab[y].kwd != NULL && strcmp(nam,mactab[y].kwd) > 0;
- y++);
- if (y == MAC_MAX) { /* No more room. */
- debug(F101,"addmac table overflow","",y);
- printf("?Macro table overflown");
- return(-1);
- } else debug(F111,"addmac position",nam,y);
- if (mactab[y].kwd != NULL) { /* Must insert */
- for (i = nmac; i > y; i--) { /* Move the rest down one slot */
- mactab[i].kwd = mactab[i-1].kwd;
- mactab[i].mval = mactab[i-1].mval;
- mactab[i].flgs = mactab[i-1].flgs;
- }
- }
- p = malloc(namlen + 1); /* Allocate space for name */
- if (!p) {
- printf("?addmac malloc error 3: %sn",nam);
- return(-1);
- }
- strcpy(p,nam); /* Copy name into new space */
- mactab[y].kwd = p; /* Add pointer to table */
- if (deflen > 0) { /* Same deal for definition */
- p = malloc(deflen + 1); /* but watch out for null pointer */
- if (p == NULL) {
- printf("?addmac malloc error 5: %sn", nam);
- if (mactab[y].kwd) {
- free(mactab[y].kwd);
- mactab[y].kwd = NULL;
- }
- return(-1);
- } else strcpy(p,def); /* Copy the definition */
- } else p = NULL;
- mactab[y].mval = p;
- mactab[y].flgs = 0;
- nmac++; /* Count this macro */
- if (tra_asg) traceval(nam,p);
- return(y);
- }
- int
- xdelmac(x) int x; { /* Delete a macro given its index */
- int i;
- extern int tra_asg;
- if (x < 0) return(x);
- if (tra_asg)
- traceval(mactab[x].kwd,NULL);
- if (mactab[x].kwd) { /* Free the storage for the name */
- free(mactab[x].kwd);
- mactab[x].kwd = NULL;
- }
- if (mactab[x].mval) { /* and for the definition */
- free(mactab[x].mval);
- mactab[x].mval = NULL;
- }
- for (i = x; i < nmac; i++) { /* Now move up the others. */
- mactab[i].kwd = mactab[i+1].kwd;
- mactab[i].mval = mactab[i+1].mval;
- mactab[i].flgs = mactab[i+1].flgs;
- }
- nmac--; /* One less macro */
- mactab[nmac].kwd = NULL; /* Delete last item from table */
- mactab[nmac].mval = NULL;
- mactab[nmac].flgs = 0;
- return(0);
- }
- int
- delmac(nam) char *nam; { /* Delete the named macro */
- int x, z;
- char *p, c;
- extern int tra_asg;
- if (!nam) return(0); /* Watch out for null pointer */
- debug(F110,"delmac nam",nam,0);
- if (*nam == CMDQ) nam++;
- if (*nam == '%') { /* If it's a variable name */
- if (!(c = *(nam+1))) return(0); /* Get variable name letter or digit */
- p = (char *)0; /* Initialize value pointer */
- if (maclvl > -1 && c >= '0' && c <= '9') { /* Digit? */
- p = m_arg[maclvl][c - '0']; /* Get pointer from macro-arg table */
- m_arg[maclvl][c - '0'] = NULL; /* Zero the table pointer */
- } else { /* It's a global variable */
- if (c < 33 || c > GVARS) return(0);
- p = g_var[c]; /* Get pointer from global-var table */
- g_var[c] = NULL; /* Zero the table entry */
- }
- if (p) {
- debug(F110,"delmac def",p,0);
- free(p); /* Free the storage */
- p = NULL;
- } else debug(F110,"delmac def","(null pointer)",0);
- if (tra_asg) traceval(nam,NULL);
- return(0);
- }
- if (*nam == '&') { /* An array reference? */
- char **q;
- if (arraynam(nam,&x,&z) < 0) /* If syntax is bad */
- return(-1); /* return -1. */
- x -= ARRAYBASE; /* Convert name to number. */
- if ((q = a_ptr[x]) == NULL) /* If array not declared, */
- return(-2); /* return -2. */
- if (z > a_dim[x]) /* If subscript out of range, */
- return(-3); /* return -3. */
- if (q[z]) { /* If there is an old value, */
- debug(F110,"delmac def",q[z],0);
- if (x != 0) /* Macro arg vector is just a copy */
- free(q[z]); /* Others are real so free them */
- q[z] = NULL;
- if (tra_asg) traceval(nam,NULL);
- } else debug(F110,"delmac def","(null pointer)",0);
- }
- /* Not a variable or an array, so it must be a macro. */
- z = isaa(nam);
- debug(F111,"delmac isaa",nam,z);
- x = z ? mxxlook(mactab,nam,nmac) : mlook(mactab,nam,nmac);
- if (x < 0) {
- debug(F111,"delmac mlook",nam,x);
- return(x);
- }
- return(xdelmac(x));
- }
- VOID
- initmac() { /* Init macro & variable tables */
- int i, j, x;
- nmac = 0; /* No macros */
- for (i = 0; i < MAC_MAX; i++) { /* Initialize the macro table */
- mactab[i].kwd = NULL;
- mactab[i].mval = NULL;
- mactab[i].flgs = 0;
- }
- x = (MAXARGLIST + 1) * sizeof(char **);
- for (i = 0; i < MACLEVEL; i++) { /* Init the macro argument tables */
- m_xarg[i] = (char **) malloc(x);
- mrval[i] = NULL; /* Macro return value */
- /* Pointer to entire argument vector, level i, for &_[] array */
- for (j = 0; j <= MAXARGLIST; j++) { /* Macro argument list */
- if (j < 10) /* For the %0..%9 variables */
- m_arg[i][j] = NULL; /* Pointer to arg j, level i. */
- if (m_xarg[i]) /* For &_[] - all args. */
- m_xarg[i][j] = NULL;
- }
- }
- for (i = 0; i < GVARS; i++) { /* And the global variables table */
- g_var[i] = NULL;
- }
- /* And the table of arrays */
- for (i = 0; i < (int) 'z' - ARRAYBASE + 1; i++) {
- a_ptr[i] = (char **) NULL; /* Null pointer for each */
- a_dim[i] = 0; /* and a dimension of zero */
- for (j = 0; j < CMDSTKL; j++) {
- aa_ptr[j][i] = (char **) NULL;
- aa_dim[j][i] = 0;
- }
- }
- }
- int
- popclvl() { /* Pop command level, return cmdlvl */
- extern int tra_cmd;
- struct localvar * v;
- int i;
- debug(F101,"popclvl cmdlvl","",cmdlvl);
- if (cmdlvl > 0) {
- if (v = localhead[cmdlvl]) { /* Did we save any variables? */
- while (v) { /* Yes */
- if (v->lv_value) /* Copy old ones back */
- addmac(v->lv_name,v->lv_value);
- else
- delmac(v->lv_name);
- v = v->lv_next;
- }
- freelocal(cmdlvl); /* Free local storage */
- }
- /* Automatic arrays do not use the localhead list */
- for (i = 0; i < 28; i++) { /* Free any local arrays */
- if (aa_ptr[cmdlvl][i]) { /* Does this one exist? */
- dclarray((char)(i+ARRAYBASE),0); /* Destroy global one */
- a_ptr[i] = aa_ptr[cmdlvl][i];
- a_dim[i] = aa_dim[cmdlvl][i];
- aa_ptr[cmdlvl][i] = (char **)NULL;
- aa_dim[cmdlvl][i] = 0;
- } else if (aa_dim[cmdlvl][i] == -23) { /* Secret code */
- dclarray((char)(i+ARRAYBASE),0); /* (see pusharray()) */
- aa_ptr[cmdlvl][i] = (char **)NULL;
- aa_dim[cmdlvl][i] = 0;
- }
- /* Otherwise do nothing - it is a local array that was declared */
- /* at a level above this one so leave it alone. */
- }
- }
- if (cmdlvl < 1) { /* If we're already at top level */
- cmdlvl = 0; /* just make sure all the */
- tlevel = -1; /* stack pointers are set right */
- maclvl = -1; /* and return */
- } else if (cmdstk[cmdlvl].src == CMD_TF) { /* Reading from TAKE file? */
- debug(F101,"popclvl tlevel","",tlevel);
- if (tlevel > -1) { /* Yes, */
- fclose(tfile[tlevel]); /* close it */
- if (tfnam[tlevel]) { /* free storage for name */
- free(tfnam[tlevel]);
- tfnam[tlevel] = NULL;
- }
- tlevel--; /* and pop take level */
- cmdlvl--; /* and command level */
- quiet = xquiet[cmdlvl];
- } else tlevel = -1;
- } else if (cmdstk[cmdlvl].src == CMD_MD) { /* In a macro? */
- debug(F101,"popclvl maclvl","",maclvl);
- if (maclvl > -1) { /* Yes, */
- #ifdef COMMENT
- int i;
- char **q;
- #endif /* COMMENT */
- macp[maclvl] = ""; /* set macro pointer to null string */
- *cmdbuf = ' '; /* clear the command buffer */
- if ((maclvl > 0) && /* 2 May 1999 */
- (m_arg[maclvl-1][0]) &&
- (!strncmp(m_arg[maclvl-1][0],"_xif",4) ||
- !strncmp(m_arg[maclvl-1][0],"_for",4) ||
- !strncmp(m_arg[maclvl-1][0],"_swi",4) ||
- !strncmp(m_arg[maclvl-1][0],"_whi",4)) &&
- mrval[maclvl+1]) {
- makestr(&(mrval[maclvl-1]),mrval[maclvl+1]);
- }
- if (maclvl+1 < MACLEVEL) {
- if (mrval[maclvl+1]) { /* Free any deeper return values. */
- free(mrval[maclvl+1]);
- mrval[maclvl+1] = NULL;
- }
- }
- maclvl--; /* Pop macro level */
- cmdlvl--; /* and command level */
- debug(F101,"popclvl mac new maclvl","",maclvl);
- debug(F111,"popclvl mac mrval[maclvl+1]",mrval[maclvl+2],maclvl+1);
- quiet = xquiet[cmdlvl];
- #ifdef COMMENT
- q = a_ptr[0];
- debug(F101,"popclvl mac 7","",maclvl);
- if (maclvl > -1)
- for (i = 0; i < 10; i++) /* Restore previous arg vector */
- q[i] = m_arg[maclvl][i];
- #else
- if (maclvl > -1) {
- a_ptr[0] = m_xarg[maclvl];
- a_dim[0] = n_xarg[maclvl];
- } else {
- a_ptr[0] = topxarg;;
- a_dim[0] = topargc;
- }
- #endif /* COMMENT */
- } else maclvl = -1;
- }
- #ifndef MAC
- if (cmdlvl < 1) { /* If back at top level */
- setint();
- concb((char)escape); /* Go into cbreak mode */
- }
- #endif /* MAC */
- if (tra_cmd && cmdlvl > 0) {
- if (cmdstk[cmdlvl].src == CMD_TF) {
- printf("[%d] -F: "%s"n",cmdlvl,tfnam[cmdstk[cmdlvl].lvl]);
- } else if (cmdstk[cmdlvl].src == CMD_MD) {
- char * m;
- m = m_arg[cmdstk[cmdlvl].lvl][0]; /* Name of this macro */
- printf("[%d] -M: "%s"n",cmdlvl,m);
- }
- }
- return(cmdlvl < 1 ? 0 : cmdlvl); /* Return command level */
- }
- #else /* No script programming language */
- int popclvl() { /* Just close current take file. */
- if (tlevel > -1) { /* if any... */
- if (tfnam[tlevel]) {
- free(tfnam[tlevel]);
- tfnam[tlevel] = NULL;
- }
- fclose(tfile[tlevel--]);
- }
- if (tlevel == -1) { /* And if back at top level */
- setint();
- concb((char)escape); /* and go back into cbreak mode. */
- }
- return(tlevel + 1);
- }
- #endif /* NOSPL */
- /* STOP - get back to C-Kermit prompt, no matter where from. */
- int
- dostop() {
- while (popclvl()) ; /* Pop all macros & take files */
- #ifndef NOSPL
- while (cmpop() > -1); /* And all recursive cmd pkg invocations */
- #endif /* NOSPL */
- cmini(ckxech); /* Clear the command buffer. */
- return(0);
- }
- /* Close the given log */
- int
- doclslog(x) int x; {
- int y;
- switch (x) {
- #ifdef DEBUG
- case LOGD:
- if (deblog <= 0) {
- printf("?Debugging log wasn't openn");
- return(0);
- }
- debug(F100,"Debug Log Closed","",0L);
- *debfil = ' ';
- deblog = 0;
- return(zclose(ZDFILE));
- #endif /* DEBUG */
- #ifndef NOXFER
- case LOGP:
- if (pktlog <= 0) {
- printf("?Packet log wasn't openn");
- return(0);
- }
- *pktfil = ' ';
- pktlog = 0;
- return(zclose(ZPFILE));
- #endif /* NOXFER */
- #ifndef NOLOCAL
- case LOGS:
- if (seslog <= 0) {
- printf("?Session log wasn't openn");
- return(0);
- }
- *sesfil = ' ';
- seslog = 0;
- return(zclose(ZSFILE));
- #endif /* NOLOCAL */
- #ifdef TLOG
- case LOGT:
- if (tralog <= 0) {
- if (msgflg) printf("?Transaction log wasn't openn");
- return(0);
- }
- tlog(F100,"Transaction Log Closed","",0L);
- *trafil = ' ';
- tralog = 0;
- return(zclose(ZTFILE));
- #endif /* TLOG */
- #ifdef CKLOGDIAL
- case LOGM:
- if (dialog <= 0) {
- if (msgflg) printf("?Connection log wasn't openn");
- return(0);
- }
- *diafil = ' ';
- dialog = 0;
- return(zclose(ZDIFIL));
- #endif /* CKLOGDIAL */
- #ifndef NOSPL
- case LOGW: /* WRITE file */
- case LOGR: /* READ file */
- y = (x == LOGR) ? ZRFILE : ZWFILE;
- if (chkfn(y) < 1) /* If no file to close */
- return(1); /* succeed silently. */
- return(zclose(y)); /* Otherwise, close the file. */
- #endif /* NOSPL */
- default:
- printf("n?Unexpected log designator - %dn", x);
- return(0);
- }
- }
- static int slc = 0; /* Screen line count */
- char *
- showoff(x) int x; {
- return(x ? "on" : "off");
- }
- char *
- showooa(x) int x; {
- switch (x) {
- case SET_OFF: return("off");
- case SET_ON: return("on");
- case SET_AUTO: return("automatic");
- default: return("(unknown)");
- }
- }
- #ifdef GEMDOS
- isxdigit(c) int c; {
- return(isdigit(c) ||
- (c >= 'a' && c <= 'f') ||
- (c >= 'A' && c <= 'F'));
- }
- #endif /* GEMDOS */
- #ifndef NOSETKEY
- #ifdef OS2
- static struct keytab shokeytab[] = { /* SHOW KEY modes */
- "all", 1, 0,
- "one", 0, 0
- };
- static int nshokey = (sizeof(shokeytab) / sizeof(struct keytab));
- #define SHKEYDEF TT_MAX+5
- struct keytab shokeymtab[] = {
- "aixterm", TT_AIXTERM, 0, /* IBM AIXterm */
- "ansi-bbs", TT_ANSI, 0, /* ANSI.SYS (BBS) */
- "at386", TT_AT386, 0, /* Unixware ANSI */
- "avatar/0+", TT_ANSI, 0, /* AVATAR/0+ */
- "ba80", TT_BA80, 0, /* Nixdorf BA80 */
- "be", TT_BEOS, CM_INV|CM_ABR,
- "beos-ansi", TT_BEOS, CM_INV, /* BeOS ANSI */
- "beterm", TT_BEOS, 0, /* BeOS Console */
- "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 */
- "default", SHKEYDEF, 0,
- "dg200", TT_DG200, 0, /* Data General DASHER 200 */
- "dg210", TT_DG210, 0, /* Data General DASHER 210 */
- "dg217", TT_DG217, 0, /* Data General DASHER 217 */
- "emacs", TT_KBM_EMACS, 0, /* Emacs mode */
- "h19", TT_H19, CM_INV, /* Heath-19 */
- "heath19", TT_H19, 0, /* Heath-19 */
- "hebrew", TT_KBM_HEBREW, 0, /* Hebrew mode */
- "hft", TT_HFT, 0, /* IBM HFT */
- "hp2621a", TT_HP2621, 0, /* HP 2621A */
- "hpterm", TT_HPTERM, 0, /* HP TERM */
- "hz1500", TT_HZL1500, 0, /* Hazeltine 1500 */
- "ibm3151", TT_IBM31, CM_INV, /* IBM 3101-xx,3161 */
- "linux", TT_LINUX, 0, /* Linux */
- "qansi", TT_QANSI, 0, /* QNX ANSI */
- "qnx", TT_QNX, 0, /* QNX */
- "russian", TT_KBM_RUSSIAN, 0, /* Russian mode */
- "scoansi", TT_SCOANSI, 0, /* SCO ANSI */
- "sni-97801", TT_97801, 0, /* Sinix 97801 */
- #ifdef OS2PM
- #ifdef COMMENT
- "tek4014", TT_TEK40, 0,
- #endif /* COMMENT */
- #endif /* OS2PM */
- "tty", TT_NONE, 0,
- "tvi910+", TT_TVI910, 0,
- "tvi925", TT_TVI925, 0,
- "tvi950", TT_TVI950, 0,
- "vc404", TT_VC4404, 0,
- "vc4404", TT_VC4404, CM_INV,
- "vip7809", TT_VIP7809, 0,
- "vt100", TT_VT100, 0,
- "vt102", TT_VT102, 0,
- "vt220", TT_VT220, 0,
- "vt220pc", TT_VT220PC, 0,
- "vt320", TT_VT320, 0,
- "vt320pc", TT_VT320PC, 0,
- "vt52", TT_VT52, 0,
- "wp", TT_KBM_WP, 0,
- "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 nshokeym = (sizeof(shokeymtab) / sizeof(struct keytab));
- #endif /* OS2 */
- VOID
- #ifdef OS2
- shokeycode(c,m) int c, m;
- #else
- shokeycode(c) int c;
- #endif
- /* shokeycode */ {
- KEY ch;
- CHAR *s;
- #ifdef OS2
- int i;
- con_event km;
- #else /* OS2 */
- int km;
- #endif /* OS2 */
- #ifdef OS2
- extern int mskkeys;
- char * mstr = "";
- if (c >= KMSIZE) {
- bleep(BP_FAIL);
- return;
- }
- #else /* OS2 */
- printf(" Key code \%d => ", c);
- #endif /* OS2 */
- #ifndef OS2
- km = mapkey(c);
- #ifndef NOKVERBS
- if (IS_KVERB(km)) { /* Kverb? */
- int i, kv;
- kv = km & ~(F_KVERB);
- printf("Verb: ");
- for (i = 0; i < nkverbs; i++)
- if (kverbs[i].kwval == kv) {
- printf("\K%s",kverbs[i].kwd);
- break;
- }
- printf("n");
- } else
- #endif /* NOKVERBS */
- if (IS_CSI(km)) {
- int xkm = km & 0xFF;
- if (xkm <= 32 || xkm >= 127)
- printf("String: \{27}[\{%d}n",xkm);
- else
- printf("String: \{27}[%cn",xkm);
- } else if (IS_ESC(km)) {
- int xkm = km & 0xFF;
- if (xkm <= 32 || xkm >= 127)
- printf("String: \{27}\{%d}n",xkm);
- else
- printf("String: \{27}%cn",xkm);
- } else if (macrotab[c]) { /* See if there's a macro */
- printf("String: "); /* If so, display its definition */
- s = macrotab[c];
- shostrdef(s);
- printf("n");
- #ifndef NOKVERBS
- } else if (km >= 0x100) { /* This means "undefined" */
- printf("Undefinedn");
- #endif /* NOKVERBS */
- } else { /* No macro, show single character */
- printf("Character: ");
- ch = km;
- if (ch < 32 || ch == 127
- #ifdef OS2
- || ch > 255
- #endif /* OS2 */
- #ifndef NEXT
- #ifndef AUX
- #ifndef XENIX
- #ifndef OS2
- || (ch > 127 && ch < 160)
- #endif /* OS2 */
- #endif /* XENIX */
- #endif /* AUX */
- #endif /* NEXT */
- )
- /*
- These used to be %d, but gcc 1.93 & later complain about type mismatches.
- %u is supposed to be totally portable.
- */
- printf("\%u",(unsigned int) ch);
- else printf("%c \%u",(CHAR) (ch & 0xff),(unsigned int) ch);
- if (ch == (KEY) c)
- printf(" (self, no translation)n");
- else
- printf("n");
- }
- #else /* OS2 */
- if (m < 0) {
- km = mapkey(c);
- mstr = "default";
- } else {
- km = maptermkey(c,m);
- for (i = 0; i < nshokeym; i++) {
- if (m == shokeymtab[i].kwval) {
- mstr = shokeymtab[i].kwd;
- break;
- }
- }
- }
- s = keyname(c);
- debug(F111,"shokeycode mstr",mstr,m);
- debug(F111,"shokeycode keyname",s,c);
- printf(" %sKey code \%d %s (%s) => ",
- mskkeys ? "mskermit " : "",
- mskkeys ? cktomsk(c) : c,
- s == NULL ? "" : s, mstr);
- switch (km.type) {
- #ifndef NOKVERBS
- case kverb: {
- int i, kv;
- kv = km.kverb.id & ~(F_KVERB);
- printf("Verb: ");
- for (i = 0; i < nkverbs; i++) {
- if (kverbs[i].kwval == kv) {
- printf("\K%s",kverbs[i].kwd);
- break;
- }
- }
- printf("n");
- break;
- }
- #endif /* NOKVERBS */
- case csi: {
- int xkm = km.csi.key & 0xFF;
- if (xkm <= 32 || xkm >= 127)
- printf("String: \{27}[\{%d}n",xkm);
- else
- printf("String: \{27}[%cn",xkm);
- break;
- }
- case esc: {
- int xkm = km.esc.key & 0xFF;
- if (xkm <= 32 || xkm >= 127)
- printf("String: \{%d}\{%d}n",ISDG200(tt_type)?30:27,xkm);
- else
- printf("String: \{%d}%cn",ISDG200(tt_type)?30:27,xkm);
- break;
- }
- case macro: {
- printf("String: "); /* Macro, display its definition */
- shostrdef(km.macro.string);
- printf("n");
- break;
- }
- case literal: {
- printf("Literal string: "); /* Literal, display its definition */
- shostrdef(km.literal.string);
- printf("n");
- break;
- }
- case error: {
- if (c >= 0x100) {
- printf("Undefinedn");
- } else {
- printf("Character: ");
- ch = c;
- if (ch < 32 || ch == 127 || ch > 255
- #ifndef NEXT
- #ifndef AUX
- #ifndef XENIX
- #ifndef OS2
- || (ch > 127 && ch < 160)
- #endif /* OS2 */
- #endif /* XENIX */
- #endif /* AUX */
- #endif /* NEXT */
- )
- /*
- These used to be %d, but gcc 1.93 & later complain about type mismatches.
- %u is supposed to be totally portable.
- */
- printf("\%u",(unsigned int) ch);
- else printf("%c \%u",(CHAR) (ch & 0xff),(unsigned int) ch);
- printf(" (self, no translation)n");
- }
- break;
- }
- case key: {
- printf("Character: ");
- ch = km.key.scancode;
- if (ch < 32 || ch == 127 || ch > 255
- #ifndef NEXT
- #ifndef AUX
- #ifndef XENIX
- #ifndef OS2
- || (ch > 127 && ch < 160)
- #else
- || (ch > 127)
- #endif /* OS2 */
- #endif /* XENIX */
- #endif /* AUX */
- #endif /* NEXT */
- )
- /*
- These used to be %d, but gcc 1.93 & later complain about type mismatches.
- %u is supposed to be totally portable.
- */
- printf("\%u",(unsigned int) ch);
- else printf("%c \%u",(CHAR) (ch & 0xff),(unsigned int) ch);
- if (ch == (KEY) c)
- printf(" (self, no translation)n");
- else
- printf("n");
- break;
- }
- }
- #endif /* OS2 */
- }
- #endif /* NOSETKEY */
- VOID
- shostrdef(s) CHAR * s; {
- CHAR ch;
- while (ch = *s++) {
- if (ch < 32 || ch == 127 || ch == 255
- /*
- Systems whose native character sets have graphic characters in C1...
- */
- #ifndef NEXT /* NeXT */
- #ifndef AUX /* Macintosh */
- #ifndef XENIX /* IBM PC */
- #ifdef OS2
- /*
- It doesn't matter whether the local host can display 8-bit characters
- or not, they are not portable among character-sets and fonts. Who
- knows what is going to be displayed
- */
- || (ch > 127)
- #else /* OS2 */
- || (ch > 127 && ch < 160)
- #endif /* OS2 */
- #endif /* XENIX */
- #endif /* AUX */
- #endif /* NEXT */
- )
- printf("\{%d}",ch); /* Display control characters */
- else putchar((char) ch); /* in backslash notation */
- }
- }
- #define xxdiff(v,sys) strncmp(v,sys,strlen(sys))
- #ifndef NOSHOW
- VOID
- shover() {
- #ifdef OS2
- extern char ckxsystem[];
- #endif /* OS2 */
- extern long xvernum;
- extern char *ck_patch, * cklibv;
- printf("nVersions:n %sn",versio);
- printf(" Numeric: %ldn",vernum);
- #ifdef OS2
- printf(" Operating System: %sn", ckxsystem);
- #else /* OS2 */
- printf(" Built for: %sn", ckxsys);
- #ifdef CK_UTSNAME
- if (unm_nam[0])
- printf(" Running on: %s %s %s %sn", unm_nam,unm_ver,unm_rel,unm_mch);
- #endif /* CK_UTSNAME */
- printf(" Patches: %sn", *ck_patch ? ck_patch : "(none)");
- #endif /* OS2 */
- if (xxdiff(ckxv,ckxsys))
- printf(" %s for%sn",ckxv,ckxsys);
- else
- printf(" %sn",ckxv);
- if (xxdiff(ckzv,ckzsys))
- printf(" %s for%sn",ckzv,ckzsys);
- else
- printf(" %sn",ckzv);
- printf(" %sn",cklibv);
- printf(" %sn",protv);
- printf(" %sn",fnsv);
- printf(" %sn %sn",cmdv,userv);
- #ifndef NOCSETS
- printf(" %sn",xlav);
- #endif /* NOCSETS */
- #ifndef MAC
- #ifndef NOLOCAL
- printf(" %sn",connv);
- #endif /* NOLOCAL */
- #endif /* MAC */
- #ifndef NODIAL
- printf(" %sn",dialv);
- #endif /* NODIAL */
- #ifndef NOSCRIPT
- printf(" %sn",loginv);
- #endif /* NOSCRIPT */
- #ifdef NETCONN
- printf(" %sn",cknetv);
- #ifdef OS2
- printf(" %sn",ckonetv);
- #ifdef CK_NETBIOS
- printf(" %sn",ckonbiv);
- #endif /* CK_NETBIOS */
- #endif /* OS2 */
- #endif /* NETCONN */
- #ifdef TNCODE
- printf(" %sn",cktelv);
- #endif /* TNCODE */
- #ifdef OS2
- #ifdef OS2MOUSE
- printf(" %sn",ckomouv);
- #endif /* OS2MOUSE */
- #endif /* OS2 */
- #ifdef CK_AUTHENTICATION
- printf(" %sn",ckathv);
- #endif /* CK_AUTHENTICATION */
- #ifdef CK_ENCRYPTION
- #ifdef CRYPT_DLL
- printf(" %sn",ck_crypt_dll_version());
- #else /* CRYPT_DLL */
- printf(" %sn",ckcrpv);
- #endif /* CRYPT_DLL */
- #endif /* CK_ENCRYPTION */
- #ifdef CK_SSL
- printf(" %sn",cksslv);
- #endif /* CK_SSL */
- printf("n");
- }
- #ifdef CK_LABELED
- VOID
- sholbl() {
- #ifdef VMS
- printf("VMS Labeled File Features:n");
- printf(" acl %s (ACL info %s)n",
- showoff(lf_opts & LBL_ACL),
- lf_opts & LBL_ACL ? "preserved" : "discarded");
- printf(" backup-date %s (backup date/time %s)n",
- showoff(lf_opts & LBL_BCK),
- lf_opts & LBL_BCK ? "preserved" : "discarded");
- printf(" name %s (original filename %s)n",
- showoff(lf_opts & LBL_NAM),
- lf_opts & LBL_NAM ? "preserved" : "discarded");
- printf(" owner %s (original file owner id %s)n",
- showoff(lf_opts & LBL_OWN),
- lf_opts & LBL_OWN ? "preserved" : "discarded");
- printf(" path %s (original file's disk:[directory] %s)n",
- showoff(lf_opts & LBL_PTH),
- lf_opts & LBL_PTH ? "preserved" : "discarded");
- #else
- #ifdef OS2
- printf("OS/2 Labeled File features (attributes):n");
- printf(" archive: %sn", showoff(lf_opts & LBL_ARC));
- printf(" extended: %sn", showoff(lf_opts & LBL_EXT));
- printf(" hidden: %sn", showoff(lf_opts & LBL_HID));
- printf(" read-only: %sn", showoff(lf_opts & LBL_RO ));
- printf(" system: %sn", showoff(lf_opts & LBL_SYS));
- #endif /* OS2 */
- #endif /* VMS */
- }
- #endif /* CK_LABELED */
- VOID
- shotcs(csl,csr) int csl, csr; { /* Show terminal character set */
- #ifndef NOCSETS
- #ifdef OS2
- extern struct _vtG G[4], *GL, *GR;
- extern int decnrcm, sni_chcode;
- extern int tt_utf8, dec_nrc, dec_kbd, dec_lang;
- printf(" Terminal character-sets:n");
- if (IS97801(tt_type_mode)) {
- if (cmask == 0377)
- printf(" Mode: 8-bit Moden");
- else
- printf(" Mode: 7-bit Moden");
- printf(" CH.CODE is %sn",sni_chcode?"On":"Off");
- } else if (ISVT100(tt_type_mode)) {
- if (decnrcm)
- printf(" Mode: 7-bit National Moden");
- else
- printf(" Mode: 8-bit Multinational Moden");
- }
- printf(" Local: %s%sn",
- isunicode() ? "Unicode/" : "",
- csl == TX_TRANSP ? "transparent" :
- csl == TX_UNDEF ? "undefined" : txrinfo[csl]->keywd);
- printf(tt_utf8 ?
- " Remote: UTF-8n %sG0: %s (%s)n":
- " Remote: %sG0: %s (%s)n",
- GL == &G[0] ? "GL->" : GR == &G[0] ? "GR->" : " ",
- txrinfo[G[0].designation]->keywd,
- G[0].designation == TX_TRANSP ? "" :
- G[0].size == cs94 ? "94 chars" :
- G[0].size == cs96 ? "96 chars" : "multi-byte");
- printf(" %sG1: %s (%s)n",
- GL == &G[1] ? "GL->" : GR == &G[1] ? "GR->" : " ",
- txrinfo[G[1].designation]->keywd,
- G[1].designation == TX_TRANSP ? "" :
- G[1].size == cs94 ? "94 chars" :
- G[1].size == cs96 ? "96 chars" : "multi-byte");
- printf(" %sG2: %s (%s)n",
- GL == &G[2] ? "GL->" : GR == &G[2] ? "GR->" : " ",
- txrinfo[G[2].designation]->keywd,
- G[2].designation == TX_TRANSP ? "" :
- G[2].size == cs94 ? "94 chars" :
- G[2].size == cs96 ? "96 chars" : "multi-byte");
- printf(" %sG3: %s (%s)n",
- GL == &G[3] ? "GL->" : GR == &G[3] ? "GR->" : " ",
- txrinfo[G[3].designation]->keywd,
- G[3].designation == TX_TRANSP ? "" :
- G[3].size == cs94 ? "94 chars" :
- G[3].size == cs96 ? "96 chars" : "multi-byte");
- printf("n");
- printf(" Keyboard character-sets:n");
- printf(" Multinational: %sn",txrinfo[dec_kbd]->keywd);
- printf(" National: %sn",txrinfo[dec_nrc]->keywd);
- #else /* OS2 */
- #ifndef MAC
- char *s;
- debug(F101,"TERM LOCAL CSET","",csl);
- debug(F101,"TERM REMOTE CSET","",csr);
- printf(" Terminal character-set: ");
- if (tcs_transp) { /* No translation */
- printf("transparentn");
- } else { /* Translation */
- printf("%s (remote) %s (local)n",
- fcsinfo[csr].keyword,fcsinfo[csl].keyword);
- if (csr != csl) {
- switch(gettcs(csr,csl)) {
- case TC_USASCII: s = "ascii"; break;
- case TC_1LATIN: s = "latin1-iso"; break;
- case TC_2LATIN: s = "latin2-iso"; break;
- case TC_CYRILL: s = "cyrillic-iso"; break;
- case TC_JEUC: s = "japanese-euc"; break;
- case TC_HEBREW: s = "hebrew-iso"; break;
- case TC_GREEK: s = "greek-iso"; break;
- case TC_9LATIN: s = "latin9-iso"; break;
- default: s = "transparent"; break;
- }
- if (strcmp(s,fcsinfo[csl].keyword) &&
- strcmp(s,fcsinfo[csr].keyword))
- printf(" (via %s)n",s);
- }
- }
- #endif /* MAC */
- #endif /* OS2 */
- #endif /* NOCSETS */
- }
- #ifdef OS2
- extern char htab[];
- VOID
- shotabs() {
- int i;
- printf("Tab Stops:nn");
- for (i = 1; i <= 70; i++)
- printf("%c",htab[i]=='T'?'T':'-');
- printf("n1.......10........20........30........40........50........60
- ........70nn");
- for (; i <= 140; i++)
- printf("%c",htab[i]=='T'?'T':'-');
- printf("n........80........90.......100.......110.......120.......130
- .......140nn");
- for (; i <= 210; i++)
- printf("%c",htab[i]=='T'?'T':'-');
- printf("n.......150.......160.......170.......180.......190.......200
- .......210nn");
- for (; i <= 255; i++)
- printf("%c",htab[i]=='T'?'T':'-');
- printf("n.......220.......230.......240.......250..255n");
- }
- #endif /* OS2 */
- #ifdef OS2MOUSE
- VOID
- shomou() {
- int button, event, id, i;
- char * name = "";
- printf("Mouse settings:n");
- printf(" Active: %snn",showoff(tt_mouse));
- for (button = 0; button < MMBUTTONMAX; button++)
- for (event = 0; event < MMEVENTSIZE; event++)
- if (mousemap[button][event].type != error)
- switch (mousemap[button][event].type) {
- case key:
- printf(" %s = Character: %c \%dn",
- mousename(button,event),
- mousemap[button][event].key.scancode,
- mousemap[button][event].key.scancode );
- break;
- case kverb:
- id = mousemap[button][event].kverb.id & ~(F_KVERB);
- if (id != K_IGNORE) {
- for (i = 0; i< nkverbs; i++)
- if (id == kverbs[i].kwval) {
- name = kverbs[i].kwd;
- break;
- }
- printf(" %s = Kverb: \K%sn",
- mousename(button,event),
- name
- );
- }
- break;
- case macro:
- printf(" %s = Macro: ",
- mousename(button,event) );
- shostrdef(mousemap[button][event].macro.string);
- printf("n");
- break;
- }
- }
- #endif /* OS2MOUSE */
- #ifndef NOLOCAL
- VOID
- shotrm() {
- char *s;
- extern int tt_print;
- #ifdef OS2
- int lines=0;
- extern int wy_autopage, autoscroll, sgrcolors, colorreset, user_erasemode,
- decscnm, decscnm_usr, tt_status, tt_diff_upd, tt_idlesnd_tmo, tt_senddata,
- wy_blockend, marginbell, marginbellcol, tt_modechg, dgunix;
- extern char * tt_idlesnd_str, * tt_trigger[];
- #ifdef PCFONTS
- int i;
- char *font;
- if (IsOS2FullScreen()) { /* Determine the font name */
- if (!os2LoadPCFonts()) {
- for (i = 0; i < ntermfont; i++) {
- if (tt_font == termfont[i].kwval) {
- font = termfont[i].kwd;
- break;
- }
- }
- } else {
- font = "(DLL not available)";
- }
- } else {
- font = "(full screen only)";
- }
- #endif /* PCFONTS */
- printf("Terminal parameters:n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %1d%-12s %13s: %1d%-14sn",
- "Bytesize: Command",
- (cmdmsk == 0377) ? 8 : 7,
- " bits","Terminal",
- (cmask == 0377) ? 8 : 7," bits");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s","Type",
- (tt_type >= 0 && tt_type <= max_tt) ?
- tt_info[tt_type].x_name :
- "unknown" );
- if (tt_type >= 0 && tt_type <= max_tt)
- if (strlen(tt_info[tt_type].x_id))
- printf(" %13s: <ESC>%s","ID",tt_info[tt_type].x_id);
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Echo",
- duplex ? "local" : "remote","Locking-shift",showoff(sosi));
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Newline-mode",
- showoff(tnlm),"Cr-display",tt_crd ? "crlf" : "normal");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Cursor",
- (tt_cursor == 2) ? "full" :
- (tt_cursor == 1) ? "half" : "underline",
- #ifdef CK_AUTODL
- "autodownload",autodl ? "on" : "off"
- #else /* CK_AUTODL */
- "", ""
- #endif /* CK_AUTODL */
- );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Arrow-keys",
- tt_arrow ? "application" : "cursor",
- "Keypad-mode", tt_keypad ? "application" : "numeric"
- );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Just to make sure we are using current info */
- updanswerbk();
- /*
- This line doesn't end with 'n' because the answerback string
- is terminated with a newline
- */
- printf(" %19s: %-13s %13s: %-15s","Answerback",
- showoff(tt_answer),"response",answerback);
- switch (tt_bell) {
- case XYB_NONE:
- s = "none";
- break;
- case XYB_VIS:
- s= "visible";
- break;
- case XYB_AUD | XYB_BEEP:
- s="beep";
- break;
- case XYB_AUD | XYB_SYS:
- s="system sounds";
- break;
- default:
- s="(unknown)";
- }
- printf(" %19s: %-13s %13s: %-15sn","Bell",s,
- "Wrap",showoff(tt_wrap));
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Autopage",showoff(wy_autopage),
- "Autoscroll",showoff(autoscroll));
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","SGR Colors",showoff(sgrcolors),
- "ESC[0m color",colorreset?"default-color":"current-color");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn",
- "Erase color",user_erasemode?"default-color":"current-color",
- "Screen mode",decscnm?"reverse":"normal");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13d %13s: %-15dn","Transmit-timeout",tt_ctstmo,
- "Output-pacing",tt_pacing);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %d secondsn","Idle-Send: string",
- tt_idlesnd_str,"interval", tt_idlesnd_tmo);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Send data",
- showoff(tt_senddata),"End of Block", wy_blockend?"crlf/etx":"us/cr");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %d secondsn","Auto-exit trigger",
- tt_trigger[0],"Output pacing",tt_pacing );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15dn","Margin bell",
- showoff(marginbell),"at column", marginbellcol);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- switch (tt_modechg) {
- case TVC_DIS: s = "disabled"; break;
- case TVC_ENA: s = "enabled"; break;
- case TVC_W95: s = "win95-restricted"; break;
- default: s = "(unknown)";
- }
- printf(" %19s: %-13s %13s: %-15sn","DG Unix mode",
- showoff(dgunix),"Video change", s);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- #ifdef CK_APC
- if (apcstatus == APC_ON) s = "on";
- else if (apcstatus == APC_OFF) s = "off";
- else if (apcstatus == APC_UNCH) s = "unchecked";
- printf(" %19s: %-13s %13s: %-15sn",
- "APC", s,
- #ifdef PCFONTS
- "Font (VGA)",font
- #else /* PCFONTS */
- "Font (VGA)","(not supported)"
- #endif /* PCFONTS */
- );
- #endif /* CK_APC */
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- #ifdef CK_TTGWSIZ /* Console terminal screen size */
- if (tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0)
- ttgwsiz(); /* Try to get latest size */
- #endif /* CK_TTGWSIZ */
- printf(" %19s: %-13d %13s: %-15dn","Height",tt_rows[VTERM],
- "Width",tt_cols[VTERM]);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %d linesn","Roll-mode",
- tt_roll[VTERM]?"insert":"overwrite","Scrollback", tt_scrsize[VTERM]);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- if (updmode == tt_updmode)
- if (updmode == TTU_FAST)
- s = "fast (fast)";
- else
- s = "smooth (smooth)";
- else
- if (updmode == TTU_FAST)
- s = "fast (smooth)";
- else
- s = "smooth (fast)";
- printf(" %19s: %-13s %13s: %d msn","Screen-update: mode",s,
- "interval",tt_update);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn",
- "Screen-optimization",showoff(tt_diff_upd),
- "Status line",showoff(tt_status));
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" %19s: %-13s %13s: %-15sn","Debug",
- showoff(debses),"Session log", seslog? sesfil : "(none)" );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Display colors (should become SHOW COLORS) */
- {
- USHORT row, col;
- char * colors[16] = {
- "black","blue","green","cyan","red","magenta","brown","lgray",
- "dgray","lblue","lgreen","lcyan","lred","lmagent","yellow","white"
- };
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" Color:");
- #ifndef ONETERMUPD
- GetCurPos(&row, &col);
- WrtCharStrAtt("border", 6, row, 9, &colorborder );
- WrtCharStrAtt("debug", 5, row, 17, &colordebug );
- WrtCharStrAtt("helptext", 8, row, 25, &colorhelp );
- WrtCharStrAtt("reverse", 7, row, 34, &colorreverse );
- WrtCharStrAtt("select", 6, row, 42, &colorselect );
- WrtCharStrAtt("status", 6, row, 50, &colorstatus );
- WrtCharStrAtt("terminal", 8, row, 58, &colornormal );
- WrtCharStrAtt("underline", 9, row, 67, &colorunderline );
- #endif /* ONETERMUPD */
- row = VscrnGetCurPos(VCMD)->y+1;
- VscrnWrtCharStrAtt(VCMD, "border", 6, row, 9, &colorborder );
- VscrnWrtCharStrAtt(VCMD, "debug", 5, row, 17, &colordebug );
- VscrnWrtCharStrAtt(VCMD, "helptext", 8, row, 25, &colorhelp );
- VscrnWrtCharStrAtt(VCMD, "reverse", 7, row, 34, &colorreverse );
- VscrnWrtCharStrAtt(VCMD, "select", 6, row, 42, &colorselect );
- VscrnWrtCharStrAtt(VCMD, "status", 6, row, 50, &colorstatus );
- VscrnWrtCharStrAtt(VCMD, "terminal", 8, row, 58, &colornormal );
- VscrnWrtCharStrAtt(VCMD, "underline", 9, row, 67, &colorunderline );
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Foreground color names */
- printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9sn","fore",
- "",
- colors[colordebug&0x0F],
- colors[colorhelp&0x0F],
- colors[colorreverse&0x0F],
- colors[colorselect&0x0F],
- colors[colorstatus&0x0F],
- colors[colornormal&0x0F],
- colors[colorunderline&0x0F] );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Background color names */
- printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9sn","back",
- colors[colorborder],
- colors[colordebug>>4],
- colors[colorhelp>>4],
- colors[colorreverse>>4],
- colors[colorselect>>4],
- colors[colorstatus>>4],
- colors[colornormal>>4],
- colors[colorunderline>>4] );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" Color:");
- #ifndef ONETERMUPD
- GetCurPos(&row, &col);
- WrtCharStrAtt("graphic", 7, row, 9, &colorgraphic );
- WrtCharStrAtt("command", 7, row, 17, &colorcmd );
- #endif /* ONETERMUPD */
- row = VscrnGetCurPos(VCMD)->y+1;
- VscrnWrtCharStrAtt(VCMD, "graphic", 7, row, 9, &colorgraphic );
- VscrnWrtCharStrAtt(VCMD, "command", 7, row, 17, &colorcmd );
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Foreground color names */
- printf("%6s: %-8s%-8sn","fore",
- colors[colorgraphic&0x0F],
- colors[colorcmd&0x0F] );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- /* Background color names */
- printf("%6s: %-8s%-8sn","back",
- colors[colorgraphic>>4],
- colors[colorcmd>>4] );
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- }
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- {
- extern int trueblink, truereverse, trueunderline;
- printf(" Attribute: blink: %-3s reverse: %-3s underline: %-3sn",
- trueblink?"on":"off", truereverse?"on":"off",
- trueunderline?"on":"off");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- }
- {
- extern vtattrib WPattrib;
- printf(" ASCII Protected chars: %s%s%s%s%s%sn",
- WPattrib.blinking?"blink ":"",
- WPattrib.reversed?"reverse ":"",
- WPattrib.underlined?"underline ":"",
- WPattrib.bold?"bold ":"",
- WPattrib.dim?"dim ":"",
- WPattrib.invisible?"invisible ":"");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- }
- printf("n");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" CONNECT-mode escape character: %d (Ctrl-%c, %s): %sn",
- escape,ctl(escape),(escape == 127 ? "DEL" : ccntab[escape]),
- nm[tt_escape]);
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- printf(" See SHOW CHARACTER-SETS for character-set infon");
- if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
- #else /* OS2 */ /* Beginning of new non-OS2 version */
- printf("n");
- printf("Terminal parameters:n");
- printf(" %19s: %1d%-12s %13s: %1d%-14sn",
- "Bytesize: Command",
- (cmdmsk == 0377) ? 8 : 7,
- " bits","Terminal",
- (cmask == 0377) ? 8 : 7," bits");
- s = getenv("TERM");
- #ifdef XPRINT
- printf(" %19s: %-13s %13s: %-15sn",
- "Type",
- s ? s : "(unknown)",
- "Print",
- showoff(tt_print)
- );
- #else
- printf(" %19s: %-13sn","Type", s ? s : "(unknown)");
- #endif /* XPRINT */
- printf(" %19s: %-13s %13s: %-15sn","Echo",
- duplex ? "local" : "remote","Locking-shift",showoff(sosi));
- printf(" %19s: %-13s %13s: %-15sn","Newline-mode",
- showoff(tnlm),"Cr-display",tt_crd ? "crlf" : "normal");
- #ifdef CK_APC
- if (apcstatus == APC_ON) s = "on";
- else if (apcstatus == APC_OFF) s = "off";
- else if (apcstatus == APC_UNCH) s = "unchecked";
- printf(" %19s: %-13s %13s: %-15sn",
- "APC", s,
- #ifdef CK_AUTODL
- "Autodownload", autodl ? "on" : "off"
- #else
- "",""
- #endif /* CK_AUTODL */
- );
- #endif /* CK_APC */
- #ifdef CK_TTGWSIZ /* Console terminal screen size */
- ttgwsiz(); /* Try to get latest size */
- printf(" %19s: %-13d %13s: %-15dn","Height",tt_rows, "Width", tt_cols);
- #endif /* CK_TTGWSIZ */
- printf(" %19s: %-13s %13s: %-15sn","Debug",
- showoff(debses),"Session log", seslog? sesfil : "(none)" );
- printf("n");
- printf(" CONNECT-mode escape character: %d (Ctrl-%c, %s): %sn",
- escape,ctl(escape),(escape == 127 ? "DEL" : ccntab[escape]),
- nm[tt_escape]
- );
- #ifndef NOCSETS
- shotcs(tcsl,tcsr); /* Show terminal character sets */
- #endif /* NOCSETS */
- #ifdef UNIX
- #ifndef NOJC
- printf(" %19s: %-13snn","Suspend", showoff(suspend));
- #endif /* NOJC */
- #endif /* UNIX */
- #endif /* OS2 */
- }
- VOID
- shmdmlin() { /* Briefly show modem & line */
- #ifndef NODIAL
- #ifndef MINIDIAL
- #ifdef OLDTBCODE
- extern int tbmodel;
- _PROTOTYP( char * gtbmodel, (void) );
- #endif /* OLDTBCODE */
- #endif /* MINIDIAL */
- #endif /* NODIAL */
- if (local)
- #ifdef OS2
- printf(" Port: %s, Modem type: ",ttname);
- #else
- printf(" Line: %s, Modem type: ",ttname);
- #endif /* OS2 */
- else
- printf(
- #ifdef OS2
- " Communication device not yet selected with SET PORTn Modem type: "
- #else
- " Communication device not yet selected with SET LINEn Modem type: "
- #endif /* OS2 */
- );
- #ifndef NODIAL
- printf("%s",gmdmtyp());
- #ifndef MINIDIAL
- #ifdef OLDTBCODE
- if (tbmodel) printf(" (%s)",gtbmodel()); /* Telebit model info */
- #endif /* OLDTBCODE */
- #endif /* MINIDIAL */
- #else
- printf("(disabled)");
- #endif /* NODIAL */
- }
- #ifdef CK_TAPI
- void
- shotapi(int option) {
- int rc=0,k ;
- char *s=NULL;
- LPDEVCFG lpDevCfg = NULL;
- LPCOMMCONFIG lpCommConfig = NULL;
- LPMODEMSETTINGS lpModemSettings = NULL;
- DCB * lpDCB = NULL;
- extern struct keytab * tapiloctab; /* Microsoft TAPI Locations */
- extern int ntapiloc;
- 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;
- extern char tapiloc[];
- extern int tapilocid;
- extern int TAPIAvail;
- if (!TAPIAvail) {
- printf("TAPI Support not enabledrn");
- return;
- }
- switch (option) {
- case 0:
- printf("TAPI Settings:n");
- printf(" Line: %sn",
- tttapi ? ttname : "(none in use)");
- cktapiBuildLocationTable(&tapiloctab, &ntapiloc);
- if (tapilocid == -1)
- tapilocid = cktapiGetCurrentLocationID();
- /* Find the current tapiloc entry */
- /* and use it as the default. */
- for (k = 0; k < ntapiloc; k++) {
- if (tapiloctab[k].kwval == tapilocid)
- break;
- }
- if (k >= 0 && k < ntapiloc)
- s = tapiloctab[k].kwd;
- else
- s = "(unknown)";
- printf(" Location: %sn",s);
- printf(" Modem-dialing: %sn",tapipass?"off":"on");
- printf(" Phone-number-conversions: %sn",
- tapiconv==CK_ON?"on":tapiconv==CK_AUTO?"auto":"off");
- printf(" Modem-lights: %s %sn",tapilights?"on ":"off",
- tapipass?"(n/a)":"");
- printf(" Predial-terminal: %s %sn",tapipreterm?"on ":"off",
- tapipass?"(n/a)":"");
- printf(" Postdial-terminal: %s %sn",tapipostterm?"on ":"off",
- tapipass?"(n/a)":"");
- printf(" Manual-dial: %s %sn",tapimanual?"on ":"off",
- tapipass?"(n/a)":"");
- printf(" Inactivity-timeout: %d seconds %sn",tapiinactivity,
- tapipass?"(n/a)":"");
- printf(" Wait-for-bong: %d seconds %sn",tapibong,
- tapipass?"(n/a)":"");
- printf(" Use-windows-configuration: %s %sn",
- tapiusecfg?"on ":"off", tapipass?"(n/a)":"");
- printf("n");
- #ifdef BETATEST
- if (tapipass) {
- printf("K-95 uses the TAPI Line in an exclusive mode. Other applicationsn");
- printf("may open the device but may not place calls nor answer calls.n");
- printf("Dialing is performed using the K-95 dialing procedures. SET MODEMn");
- printf("TYPE TAPI after the SET TAPI LINE command to activate the modemn");
- printf("definition associated with the active TAPI LINE device.nn");
- } else {
- printf("K-95 uses the TAPI Line in a cooperative mode. Other applicationsn");
- printf("may open the device, place and answer calls. Dialing is performedn");
- printf("by TAPI. K-95 SET MODEM commands are not used.nn");
- }
- if (tapiconv == CK_ON ||
- tapiconv == CK_AUTO && !tapipass) {
- printf(
- "Phone numbers are converted from canonical to dialable form by TAPIn");
- printf("using the dialing rules specified in the TAPI Dialing Propertiesn");
- printf("dialog.nn");
- } else {
- printf(
- "Phone numbers are converted from canonical to dialable form by K-95n");
- printf(
- "using the dialing rules specified with the SET DIAL commands. TAPIn");
- printf(
- "Dialing Properties are imported automaticly upon startup and whenevern");
- printf("the TAPI Dialing Properties are altered or when the TAPI Locationn");
- printf("is changed.nn");
- }
- #endif /* BETATEST */
- if (tapipass) {
- printf("Type SHOW MODEM to see MODEM configuration.n");
- if (tapiconv == CK_ON)
- printf("Type SHOW DIAL to see DIAL-related items.n");
- } else {
- if (tapiconv == CK_ON || tapiconv == CK_AUTO)
- printf("Type SHOW DIAL to see DIAL-related items.n");
- }
- break;
- case 1:
- cktapiDisplayTapiLocationInfo();
- break;
- case 2:
- rc = cktapiGetModemSettings(&lpDevCfg,&lpModemSettings,
- &lpCommConfig,&lpDCB);
- if (rc) {
- cktapiDisplayModemSettings(lpDevCfg,lpModemSettings,
- lpCommConfig,lpDCB);
- } else {
- printf("?Unable to retrieve Modem Settingsn");
- }
- break;
- case 3: {
- HANDLE hModem = GetModemHandleFromLine((HLINE)0);
- if (hModem)
- DisplayCommProperties(hModem);
- else
- printf("?Unable to retrieve a valid Modem Handlen");
- CloseHandle(hModem);
- break;
- }
- }
- printf("n");
- }
- #endif /* CK_TAPI */
- #endif /* NOLOCAL */
- #ifdef PATTERNS
- static VOID
- shopat() {
- extern char * binpatterns[], * txtpatterns[];
- extern int patterns;
- char **p, *s;
- int i, j, k, n, flag, width;
- #ifdef CK_TTGWSIZ
- ttgwsiz(); /* Try to get latest size */
- #ifdef OS2
- width = tt_cols[VCMD];
- #else /* OS2 */
- width = tt_cols;
- #endif /* OS2 */
- if (width < 1)
- #endif /* CK_TTGWSIZ */
- width = 80;
- printf("n");
- printf(" Set file type: %sn",gfmode(binary,1));
- printf(" Set file patterns: %s", showooa(patterns));
- #ifdef CK_LABELED
- if (binary == XYFT_L)
- printf(" (but SET FILE TYPE LABELED overrides)n");
- else
- #endif /* CK_LABELED */
- #ifdef VMS
- if (binary == XYFT_I)
- printf(" (but SET FILE TYPE IMAGE overrides)n");
- else
- #endif /* VMS */
- printf("n");
- printf(" Maximum patterns allowed: %dn", FTPATTERNS);
- for (k = 0; k < 2; k++) { /* For each kind of patter */
- printf("n");
- if (k == 0) { /* binary... */
- printf(" File binary-patterns: ");
- p = binpatterns;
- } else { /* text... */
- printf(" File text-patterns: ");
- p = txtpatterns;
- }
- if (!p[0]) {
- printf("(none)n");
- } else {
- printf("n ");
- n = 2;
- for (i = 0; i < FTPATTERNS; i++) { /* For each pattern */
- if (!p[i]) /* Done */
- break;
- s = p[i]; /* Look for embedded space */
- for (j = 0, flag = 1; *s; s++, j++) /* and also get length */
- if (*s == SP)
- flag = 3;
- n += j + flag; /* Length of this line */
- if (n >= width - 1) {
- printf("n ");
- n = j+2;
- }
- printf(flag == 3 ? " {%s}" : " %s", p[i]);
- }
- if (n > 2)
- printf("n");
- }
- }
- printf("n");
- }
- #endif /* PATTERNS */
- #ifndef NOSPL
- static VOID
- shooutput() {
- printf(" Output pacing: %d (milliseconds)n",pacing);
- printf(" Output special-escapes: %sn", showoff(outesc));
- }
- static VOID
- shoinput() {
- #ifdef CK_AUTODL
- printf(" Input autodownload: %sn", showoff(inautodl));
- #endif /* CK_AUTODL */
- printf(" Input cancellation: %sn", showoff(inintr));
- printf(" Input case: %sn", inpcas[cmdlvl] ?
- "observe" : "ignore");
- printf(" Input buffer-length: %dn", inbufsize);
- printf(" Input echo: %sn", showoff(inecho));
- printf(" Input silence: %d (seconds)n", insilence);
- #ifdef OS2
- printf(" Input terminal: %sn", showoff(interm));
- #endif /* OS2 */
- printf(" Input timeout: %sn", intime[cmdlvl] ?
- "quit" : "proceed");
- if (instatus < 0)
- printf(" Last INPUT: -1 (INPUT command not yet given)n");
- else
- printf(" Last INPUT: %d (%s)n", instatus,i_text[instatus]);
- }
- #endif /* NOSPL */
- #ifndef NOSPL
- int
- showarray() {
- #ifdef COMMENT
- char * p, * q, ** ap;
- int i;
- #endif /* COMMENT */
- char buf[16];
- char *s; int x = 0, y;
- int range[2];
- if ((y = cmfld("Array name","",&s,NULL)) < 0)
- if (y != -3)
- return(y);
- strcpy(line,s);
- s = line;
- if ((y = cmcfm()) < 0)
- return(y);
- if (*s) {
- char ** ap;
- if ((x = arraybounds(s,&(range[0]),&(range[1]))) < 0) {
- printf("?Bad array: %sn",s);
- return(-9);
- }
- #ifdef COMMENT
- range[0] = -1;
- range[1] = -1;
- p = s;
- for (p = s, q = NULL; *p; p++) {
- if (*p == '[') {
- q = p+1;
- } else if (*p == ']')
- break;
- }
- if (q && *p == ']') {
- int quitnow = 0;
- for (i = 0; i < 2 && !quitnow; i++) {
- for (p = q; *p; p++) {
- if (i == 0 && *p == ':' ||
- *p == ']') {
- if (*p == ']')
- quitnow = 1;
- *p = NUL;
- if (*q) {
- y = 15;
- s = buf;
- zzstring(q,&s,&y);
- s = evalx(buf);
- if (s) if (*s) ckstrncpy(buf,s,16);
- if (!rdigits(buf)) {
- printf("?Not numeric: %sn",buf);
- return(-9);
- }
- q = (i == 0) ? p+1 : NULL;
- range[i] = atoi(buf);
- }
- break;
- }
- }
- }
- }
- #endif /* COMMENT */
- ap = a_ptr[x];
- if (!ap) {
- printf("Array not declared: %sn", s);
- return(success = 1);
- } else {
- int i, n, max;
- max = (range[1] > 0) ?
- range[1] :
- ((range[0] > 0) ? range[0] : a_dim[x]);
- if (range[0] < 0)
- range[0] = 0;
- if (max > a_dim[x])
- max = a_dim[x];
- n = 1;
- printf("Dimension = %dn",a_dim[x]);
- for (i = range[0]; i <= max; i++) {
- if (ap[i]) {
- printf("%3d. %sn",i,ap[i]);
- if (xaskmore) {
- if (cmd_cols > 0) {
- x = strlen(ap[i]) + 5;
- y = (x % cmd_cols) ? 1 : 0;
- n += (x / cmd_cols) + y;
- } else {
- n++;
- }
- if (n > (cmd_rows - 3)) {
- if (!askmore())
- break;
- else
- n = 0;
- }
- }
- }
- }
- }
- return(1);
- }
- /* All arrays - just show name and dimension */
- for (y = 0; y < (int) 'z' - ARRAYBASE + 1; y++) {
- if (a_ptr[y]) {
- if (x == 0) printf("Declared arrays:n");
- x = 1;
- printf(" \&%c[%d]n",
- (y == 1) ? 64 : y + ARRAYBASE, a_dim[y]);
- }
- if (!x) printf(" No arrays declaredn");
- }
- return(1);
- }
- #endif /* NOSPL */
- int
- doshow(x) int x; {
- int y, z, i; long zz;
- extern int optlines;
- char *s;
- #ifdef OS2
- extern int os2gks;
- extern int tt_kb_mode;
- #endif /* OS2 */
- extern int srvcdmsg;
- extern char * cdmsgstr, * ckcdpath;
- #ifndef NOSETKEY
- if (x == SHKEY) { /* SHOW KEY */
- int c;
- #ifdef OS2
- if ((x = cmkey(shokeytab,nshokey,"How many keys should be shown?",
- "one",xxstring)) < 0) return(x);
- switch (tt_kb_mode) {
- case KBM_EM:
- s = "emacs";
- break;
- case KBM_HE:
- s = "hebrew";
- break;
- case KBM_RU:
- s = "russian";
- break;
- case KBM_EN:
- default:
- s = "default";
- break;
- }
- if ((z = cmkey(shokeymtab,nshokeym,"Which definition should be shown?",
- s,xxstring)) < 0) return(z);
- if (z == SHKEYDEF)
- z = -1;
- #endif /* OS2 */
- if ((y = cmcfm()) < 0) return(y);
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- #ifdef MAC
- printf("Not implementedn");
- return(0);
- #else /* Not MAC */
- #ifdef OS2
- if (x) {
- con_event evt;
- for (c = 0; c < KMSIZE; c++) {
- evt = (z < 0) ? mapkey(c) : maptermkey(c,z);
- if (evt.type != error) {
- shokeycode(c,z);
- }
- }
- } else {
- #endif /* OS2 */
- printf(" Press key: ");
- #ifdef UNIX
- #ifdef NOSETBUF
- fflush(stdout);
- #endif /* NOSETBUF */
- #endif /* UNIX */
- conbin((char)escape); /* Put terminal in binary mode */
- #ifdef OS2
- os2gks = 0; /* Raw scancode processing */
- #endif /* OS2 */
- c = congks(0); /* Get character or scan code */
- #ifdef OS2
- os2gks = 1; /* Cooked scancode processing */
- #endif /* OS2 */
- concb((char)escape); /* Restore terminal to cbreak mode */
- if (c < 0) { /* Check for error */
- printf("?Error reading keyn");
- return(0);
- }
- #ifndef OS2
- /*
- Do NOT mask when it can be a raw scan code, perhaps > 255
- */
- c &= cmdmsk; /* Apply command mask */
- #endif /* OS2 */
- printf("n");
- #ifdef OS2
- shokeycode(c,z);
- #else /* OS2 */
- shokeycode(c);
- #endif /* OS2 */
- #ifdef OS2
- }
- #endif /* OS2 */
- return(1);
- #endif /* MAC */
- }
- #ifndef NOKVERBS
- if (x == SHKVB) { /* SHOW KVERBS */
- if ((y = cmcfm()) < 0) return(y);
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- printf("nThe following %d keyboard verbs are available:nn",nkverbs);
- kwdhelp(kverbs,nkverbs,"","\K","",3,0);
- printf("n");
- return(1);
- }
- #ifdef OS2
- if (x == SHUDK) { /* SHOW UDKs */
- extern void showudk(void);
- if ((y = cmcfm()) < 0) return(y);
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- showudk();
- return(1);
- }
- #endif /* OS2 */
- #endif /* NOKVERBS */
- #endif /* NOSETKEY */
- #ifndef NOSPL
- if (x == SHMAC) { /* SHOW MACRO */
- struct FDB kw, fl, cm;
- for (y = 0; y < nmac; y++) { /* copy the macro table */
- mackey[y].kwd = mactab[y].kwd; /* into a regular keyword table */
- mackey[y].kwval = y; /* with value = pointer to macro tbl */
- mackey[y].flgs = mactab[y].flgs;
- }
- /* parse name as keyword */
- cmfdbi(&kw, /* First FDB - command switches */
- _CMKEY, /* fcode */
- "Macro name", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- nmac, /* addtl numeric data 1: tbl size */
- 0, /* addtl numeric data 2: 4 = cmswi */
- xxstring, /* Processing function */
- mackey, /* Keyword table */
- &fl /* Pointer to next FDB */
- );
- cmfdbi(&fl, /* 2nd FDB - command to send from */
- _CMFLD, /* fcode */
- "Pattern", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- xxstring,
- NULL,
- &cm
- );
- cmfdbi(&cm, /* 4th FDB - Confirmation */
- _CMCFM, /* fcode */
- "", /* hlpmsg */
- "", /* default */
- "", /* addtl string data */
- 0, /* addtl numeric data 1 */
- 0, /* addtl numeric data 2 */
- NULL,
- NULL,
- NULL
- );
- x = cmfdb(&kw);
- if (x < 0) return(x);
- switch (cmresult.fcode) {
- case _CMKEY:
- case _CMFLD:
- strcpy(line,atmbuf);
- if ((x = cmcfm()) < 0)
- return(x);
- break;
- case _CMCFM:
- line[0] = NUL;
- default:
- break;
- }
- s = line;
- if (*line) {
- slc = 0; /* Initial SHO MAC line number */
- x = mlook(mactab,s,nmac); /* Look up what they typed */
- switch (x) {
- case -3: /* Nothing to look up */
- return(0);
- case -1: /* Not found */
- printf("%s - not foundn",s);
- return(0);
- case -2: /* Ambiguous, matches more than one */
- y = (int)strlen(line);
- slc = 1;
- for (x = 0; x < nmac; x++)
- if (!strncmp(mactab[x].kwd,line,y))
- if (shomac(mactab[x].kwd,mactab[x].mval) < 0) break;
- return(1);
- default: /* Matches one exactly */
- shomac(mactab[x].kwd,mactab[x].mval);
- return(1);
- }
- } else { /* They want to see them all */
- printf("Macros:n");
- slc = 1;
- for (y = 0; y < nmac; y++)
- if (shomac(mactab[y].kwd,mactab[y].mval) < 0) break;
- return(1);
- }
- }
- #endif /* NOSPL */
- /*
- Other SHOW commands only have two fields. Get command confirmation here,
- then handle with big switch() statement.
- */
- #ifndef NOSPL
- if (x != SHBUI && x != SHARR)
- #endif /* NOSPL */
- if ((y = cmcfm()) < 0)
- return(y);
- #ifdef COMMENT
- /* This restriction is too general. */
- #ifdef IKSD
- if (inserver &&
- #ifdef CK_LOGIN
- isguest
- #else
- 0
- #endif /* CK_LOGIN */
- ) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- #endif /* COMMENT */
- switch (x) {
- #ifdef ANYX25
- #ifndef IBMX25
- case SHPAD:
- shopad(0);
- break;
- #endif /* IBMX25 */
- #endif /* ANYX25 */
- case SHNET:
- #ifdef NOLOCAL
- printf(" No network support in this version of C-Kermit.n");
- #else
- #ifndef NETCONN
- printf(" No network support in this version of C-Kermit.n");
- #else
- shonet();
- #endif /* NETCONN */
- #endif /* NOLOCAL */
- break;
- case SHPAR:
- shopar();
- break;
- #ifndef NOXFER
- case SHATT:
- shoatt();
- break;
- #endif /* NOXFER */
- #ifndef NOSPL
- case SHCOU:
- printf(" %dn",count[cmdlvl]);
- break;
- #endif /* NOSPL */
- #ifndef NOSERVER
- case SHSER: /* Show Server */
- i = 0;
- #ifndef NOFRILLS
- printf("Function: Status:n");
- i++;
- printf(" GET %sn",nm[en_get]);
- i++;
- printf(" SEND %sn",nm[en_sen]);
- i++;
- printf(" MAIL %sn",nm[inserver ? 0 : en_mai]);
- i++;
- printf(" PRINT %sn",nm[inserver ? 0 : en_pri]);
- i++;
- #ifndef NOSPL
- printf(" REMOTE ASSIGN %sn",nm[en_asg]);
- i++;
- #endif /* NOSPL */
- printf(" REMOTE CD/CWD %sn",nm[en_cwd]);
- i++;
- #ifdef ZCOPY
- printf(" REMOTE COPY %sn",nm[en_cpy]);
- i++;
- #endif /* ZCOPY */
- printf(" REMOTE DELETE %sn",nm[en_del]);
- printf(" REMOTE DIRECTORY %sn",nm[en_dir]);
- printf(" REMOTE HOST %sn",nm[inserver ? 0 : en_hos]);
- i += 3;
- #ifndef NOSPL
- printf(" REMOTE QUERY %sn",nm[en_que]);
- i++;
- #endif /* NOSPL */
- printf(" REMOTE MKDIR %sn",nm[en_mkd]);
- printf(" REMOTE RMDIR %sn",nm[en_rmd]);
- printf(" REMOTE RENAME %sn",nm[en_ren]);
- printf(" REMOTE SET %sn",nm[en_set]);
- printf(" REMOTE SPACE %sn",nm[en_spa]);
- printf(" REMOTE TYPE %sn",nm[en_typ]);
- printf(" REMOTE WHO %sn",nm[inserver ? 0 : en_who]);
- printf(" BYE %sn",nm[en_bye]);
- printf(" FINISH %sn",nm[en_fin]);
- printf(" EXIT %sn",nm[en_xit]);
- printf(" ENABLE %sn",nm[en_ena]);
- i += 11;
- #endif /* NOFRILLS */
- if (i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server timeout: %dn",srvtim);
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server idle-timeout: %dn",srvidl);
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server keepalive %sn", showoff(srvping));
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server cd-message %sn", showoff(srvcdmsg));
- if (srvcdmsg && cdmsgstr)
- printf("Server cd-message %sn", cdmsgstr);
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server display: %sn", showoff(srvdis));
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server login: ");
- if (!x_user) {
- printf("(none)n");
- } else {
- printf(""%s", "%s", "%s"n",
- x_user,
- x_passwd ? x_passwd : "",
- x_acct ? x_acct : ""
- );
- }
- if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
- printf("Server get-path: ");
- if (ngetpath == 0) {
- printf(" (none)n");
- } else {
- printf("n");
- i += 3;
- for (x = 0; x < ngetpath; x++) {
- if (getpath[x]) printf(" %d. %sn", x, getpath[x]);
- if (++i > (cmd_rows - 3)) { /* More than a screenful... */
- if (!askmore())
- break;
- else
- i = 0;
- }
- }
- }
- break;
- #endif /* NOSERVER */
- case SHSTA: /* Status of last command */
- printf(" %sn", success ? "SUCCESS" : "FAILURE");
- return(0); /* Don't change it */
- case SHSTK: { /* Stack for MAC debugging */
- #ifdef MAC
- long sp;
- sp = -1;
- loadA0 ((char *)&sp); /* set destination address */
- SPtoaA0(); /* move SP to destination */
- printf("Stack at 0x%xn", sp);
- show_queue(); /* more debugging */
- break;
- #else
- shostack();
- #endif /* MAC */
- break;
- }
- #ifdef OS2
- case SHTAB: /* SHOW TABS */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotabs();
- break;
- #endif /* OS2 */
- #ifndef NOLOCAL
- case SHTER: /* SHOW TERMINAL */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotrm();
- break;
- #endif /* NOLOCAL */
- #ifdef OS2
- case SHVSCRN: /* SHOW Virtual Screen - for debug */
- shovscrn();
- break;
- #endif /* OS2 */
- #ifdef OS2MOUSE
- case SHMOU: /* SHOW MOUSE */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shomou();
- break;
- #endif /* OS2MOUSE */
- #ifndef NOFRILLS
- case SHVER:
- shover();
- break;
- #endif /* NOFRILLS */
- #ifndef NOSPL
- case SHBUI: /* Built-in variables */
- if ((y = cmtxt("Variable name or pattern","",&s,xxstring)) < 0)
- return(y);
- strcpy(line,s);
- if (line[0]) strcat(line,"*");
- case SHFUN: /* or built-in functions */
- #ifdef CK_TTGWSIZ
- #ifdef OS2
- if (tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0)
- ttgwsiz();
- #else /* OS2 */
- if (ttgwsiz() > 0) { /* Get current screen size */
- if (tt_rows > 0 && tt_cols > 0) {
- cmd_rows = tt_rows;
- cmd_cols = tt_cols;
- }
- }
- #endif /* OS2 */
- #endif /* CK_TTGWSIZ */
- if (x == SHFUN) { /* Functions */
- printf("nThe following functions are available:nn");
- kwdhelp(fnctab,nfuncs,"","\F","()",3,0);
- printf("n");
- #ifndef NOHELP
- printf(
- "HELP FUNCTION <name> gives the calling conventions of the given function.nn"
- );
- #endif /* NOHELP */
- break;
- } else { /* Variables */
- i = 0;
- for (y = 0; y < nvars; y++) {
- if ((vartab[y].flgs & CM_INV))
- continue;
- if (line[0])
- if (!ckmatch(line,vartab[y].kwd,0,1))
- continue;
- s = nvlook(vartab[y].kwd);
- printf(" \v(%s) = ",vartab[y].kwd);
- if (vartab[y].kwval == VN_NEWL) { /* v(newline) */
- while (*s) /* Show control chars symbolically */
- printf("\{%d}",*s++);
- printf("n");
- } else if (vartab[y].kwval == VN_IBUF || /* v(input) */
- vartab[y].kwval == VN_QUE || /* v(query) */
- #ifdef OS2
- vartab[y].kwval == VN_SELCT || /* v(select) */
- #endif /* OS2 */
- (vartab[y].kwval >= VN_M_AAA && /* modem ones */
- vartab[y].kwval <= VN_M_ZZZ)
- ) {
- int r = 12; /* This one can wrap around */
- char buf[10];
- while (*s) {
- if (isprint(*s)) {
- buf[0] = *s;
- buf[1] = NUL;
- r++;
- } else {
- sprintf(buf,"\{%d}",*s);
- r += (int) strlen(buf);
- }
- if (r >= cmd_cols - 1) {
- printf("n");
- r = 0;
- i++;
- }
- printf("%s",buf);
- s++;
- }
- printf("n");
- } else
- printf("%sn",s);
- if (++i > (cmd_rows - 3)) { /* More than a screenful... */
- if ((y >= nvars - 1) || !askmore())
- break;
- else
- i = 0;
- }
- }
- }
- break;
- case SHVAR: /* Global variables */
- x = 0; /* Variable count */
- slc = 1; /* Screen line count for "more?" */
- for (y = 33; y < GVARS; y++)
- if (g_var[y]) {
- if (x++ == 0) printf("Global variables:n");
- sprintf(line," \%%%c",y);
- if (shomac(line,g_var[y]) < 0) break;
- }
- if (!x) printf(" No variables definedn");
- break;
- case SHARG: { /* Args */
- char * s1, * s2;
- if (maclvl > -1) {
- printf("Macro arguments at level %d (\v(argc) = %d):n",
- maclvl,
- macargc[maclvl]
- );
- for (y = 0; y < macargc[maclvl]; y++) {
- s1 = m_arg[maclvl][y];
- if (!s1) s1 = "(NULL)";
- s2 = m_xarg[maclvl][y];
- if (!s2) s2 = "(NULL)";
- if (y < 10)
- printf(" \%%%d = %sn",y,s1);
- else
- printf(" \&_[%d] = %sn",y,s2);
- }
- } else {
- printf("Top-level arguments (\v(argc) = %d):n", topargc);
- for (y = 0; y < topargc; y++) {
- s1 = g_var[y + '0'];
- if (!s1) s1 = "(NULL)";
- s2 = toparg[y];
- if (!s2) s2 = "(NULL)";
- if (y < 10 && g_var[y])
- printf(" \%%%d = %sn",y,s1);
- if (toparg[y])
- printf(" \&_[%d] = %sn",y,s2);
- }
- }
- }
- break;
- case SHARR: /* Arrays */
- return(showarray());
- #endif /* NOSPL */
- #ifndef NOXFER
- case SHPRO: /* Protocol parameters */
- shoparp();
- printf("n");
- break;
- #endif /* NOXFER */
- #ifndef NOLOCAL
- case SHCOM: /* Communication parameters */
- printf("n");
- shoparc();
- #ifdef OS2
- {
- int i;
- char *s = "(unknown)";
- for (i = 0; i < nprty; i++)
- if (prtytab[i].kwval == priority) {
- s = prtytab[i].kwd;
- break;
- }
- printf(" Priority: %sn", s );
- }
- #endif /* OS2 */
- printf("n");
- #ifdef NETCONN
- if (!network
- #ifdef IKSD
- && !inserver
- #endif /* IKSD */
- ) {
- #endif /* NETCONN */
- shomdm();
- printf("n");
- #ifdef NETCONN
- }
- #endif /* NETCONN */
- #ifndef NODIAL
- #ifdef IKSD
- if ( !inserver )
- #endif /* IKSD */
- {
- printf("Type SHOW DIAL to see DIAL-related items.n");
- printf("Type SHOW MODEM to see modem-related items.n");
- #ifdef CK_TAPI
- printf("Type SHOW TAPI to see TAPI-related items.n");
- #endif /* CK_TAPI */
- printf("n");
- }
- #endif /* NODIAL */
- break;
- #endif /* NOLOCAL */
- case SHFIL: /* File parameters */
- shofil();
- /* printf("n"); */ /* (out o' space) */
- break;
- #ifndef NOCSETS
- case SHLNG: /* Languages */
- shoparl();
- break;
- #endif /* NOCSETS */
- #ifndef NOSPL
- case SHSCR: /* Scripts */
- printf("n");
- printf(" Command quoting: %sn", showoff(cmdgquo()));
- printf(" Take echo: %sn", showoff(techo));
- printf(" Take error: %sn", showoff(takerr[cmdlvl]));
- printf(" Macro echo: %sn", showoff(mecho));
- printf(" Macro error: %sn", showoff(merror[cmdlvl]));
- printf(" Quiet: %sn", showoff(quiet));
- printf(" Function diagnostics: %sn", showoff(fndiags));
- printf(" Function error: %sn", showoff(fnerror));
- shoinput();
- shooutput();
- #ifndef NOSCRIPT
- printf(" Script echo: %sn", showoff(secho));
- #endif /* NOSCRIPT */
- printf(" Command buffer length: %dn", CMDBL);
- printf(" Atom buffer length: %dn", ATMBL);
- printf("n");
- break;
- #endif /* NOSPL */
- #ifndef NOXMIT
- case SHXMI:
- printf("n");
- printf(" File type: %sn",
- binary ? "binary" : "text");
- #ifndef NOCSETS
- printf(" File character-set: %sn",
- fcsinfo[fcharset].keyword);
- printf(" Terminal character-set (remote): %sn",
- fcsinfo[tcsr].keyword);
- printf(" Terminal character-set (local): %sn",
- fcsinfo[tcsl].keyword);
- #endif /* NOCSETS */
- printf(" Terminal bytesize: %dn",
- (cmask == 0xff) ? 8 : 7);
- printf(" Terminal echo: %sn",
- duplex ? "local" : "remote");
- printf(" Transmit EOF: ");
- if (*xmitbuf == NUL) {
- printf("(none)n");
- } else {
- char *p;
- p = xmitbuf;
- while (*p) {
- if (*p < SP)
- printf("^%c",ctl(*p));
- else
- printf("%c",*p);
- p++;
- }
- printf("n");
- }
- if (xmitf)
- printf(" Transmit Fill: %dn", xmitf);
- else
- printf(" Transmit Fill: (none)n");
- printf(" Transmit Linefeed: %sn",showoff(xmitl));
- if (xmitp)
- printf(" Transmit Prompt: %d (%s)n",
- xmitp,
- chartostr(xmitp)
- );
- else
- printf(" Transmit Prompt: (none)n");
- printf(" Transmit Echo: %sn", showoff(xmitx));
- printf(" Transmit Locking-Shift: %sn", showoff(xmits));
- printf(" Transmit Pause: %d (millisecond%s)n",
- xmitw,
- (xmitw == 1) ? "" : "s"
- );
- printf(" Transmit Timeout: %d (second%s)n",
- xmitt,
- (xmitt == 1) ? "" : "s"
- );
- printf("n");
- break;
- #endif /* NOXMIT */
- #ifndef NODIAL
- case SHMOD: /* SHOW MODEM */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shomodem(); /* Show SET MODEM items */
- break;
- #endif /* NODIAL */
- #ifndef MAC
- case SHDFLT:
- printf("%sn",zgtdir());
- break;
- #endif /* MAC */
- #ifndef NOLOCAL
- case SHESC:
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- printf(" Escape character: Ctrl-%c (ASCII %d, %s): %srn",
- ctl(escape), escape, (escape == 127 ? "DEL" : ccntab[escape]),
- nm[tt_escape]
- );
- break;
- #ifndef NODIAL
- case SHDIA: /* SHOW DIAL */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shmdmlin();
- printf(", speed: ");
- if ((zz = ttgspd()) < 0) {
- printf("unknown");
- } else {
- if (zz == 8880) printf("75/1200"); else printf("%ld",zz);
- }
- if (carrier == CAR_OFF) s = "off";
- else if (carrier == CAR_ON) s = "on";
- else if (carrier == CAR_AUT) s = "auto";
- else s = "unknown";
- printf(", carrier: %s", s);
- if (carrier == CAR_ON) {
- if (cdtimo) printf(", timeout: %d sec", cdtimo);
- else printf(", timeout: none");
- }
- printf("n");
- doshodial();
- if (local
- #ifdef NETCONN
- && !network
- #endif /* NETCONN */
- ) {
- printf("Type SHOW MODEM to see modem settings.n");
- #ifdef CK_TAPI
- printf("Type SHOW TAPI to see TAPI-related itemsn");
- #endif /* CK_TAPI */
- printf("Type SHOW COMMUNICATIONS to see modem signals.n");
- }
- break;
- #endif /* NODIAL */
- #endif /* NOLOCAL */
- #ifndef NOXFER
- #ifdef CK_LABELED
- case SHLBL: /* Labeled file info */
- sholbl();
- break;
- #endif /* CK_LABELED */
- #endif /* NOXFER */
- case SHCSE: /* Character sets */
- #ifdef NOCSETS
- printf(
- " Character set translation is not supported in this version of C-Kermitn");
- #else
- shocharset();
- #ifndef NOXFER
- printf("n Unknown-Char-Set: %sn",
- unkcs ? "Keep" : "Discard");
- #endif /* NOXFER */
- #ifdef OS2
- printf("n");
- #endif /* OS2 */
- shotcs(tcsl,tcsr);
- printf("n");
- #ifdef OS2
- /* PC Code Page information */
- {
- char cpbuf[50];
- int cplist[16], cps;
- cps = os2getcplist(cplist, sizeof(cplist));
- sprintf(cpbuf,"%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d",
- cps > 1 ? cplist[1] : 0,
- cps > 2 ? cplist[2] : 0, cps > 3 ? cplist[3] : 0,
- cps > 4 ? cplist[4] : 0, cps > 5 ? cplist[5] : 0,
- cps > 6 ? cplist[6] : 0, cps > 7 ? cplist[7] : 0,
- cps > 8 ? cplist[8] : 0, cps > 9 ? cplist[9] : 0,
- cps > 10 ? cplist[10] : 0, cps > 11 ? cplist[11] : 0,
- cps > 12 ? cplist[12] : 0
- );
- printf(" Code Pages:n");
- printf(" Active: %dn",os2getcp());
- if (!isWin95())
- printf(" Available: %sn",cpbuf);
- printf("n");
- }
- #endif /* OS2 */
- #endif /* NOCSETS */
- break;
- case SHFEA: /* Features */
- shofea();
- break;
- #ifdef CK_SPEED
- case SHCTL: /* Control-Prefix table */
- shoctl();
- break;
- #endif /* CK_SPEED */
- case SHEXI:
- printf("n Exit warning %sn", xitwarn ?
- (xitwarn == 1 ? "on" : "always") : "off");
- printf(" Exit on-disconnect: %sn", showoff(exitonclose));
- printf(" Current exit status: %dnn", xitsta);
- break;
- case SHPRT: {
- #ifdef PRINTSWI
- extern int printtimo, printertype, noprinter;
- extern char * printterm, * printsep;
- #ifdef BPRINT
- extern int printbidi;
- #endif /* BPRINT */
- #endif /* PRINTSWI */
- #ifdef IKSD
- if (inserver &&
- #ifdef CK_LOGIN
- isguest
- #else /* CK_LOGIN */
- 0
- #endif /* CK_LOGIN */
- ) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- #ifdef PRINTSWI
- if (noprinter) {
- printf("Printer: (none)nn");
- break;
- }
- #endif /* PRINTSWI */
- printf("Printer: %s%sn",
- printpipe ? "| " : "",
- printername ? printername :
- #ifdef OS2
- "PRN"
- #else
- "(default)"
- #endif /* OS2 */
- );
- #ifdef PRINTSWI
- #ifdef BPRINT
- if (printbidi) {
- printf(" /BIDIRECTIONALn");
- if (pportspeed > 0)
- printf(" /SPEED:%ldn",pportspeed);
- printf(" /PARITY:%sn",parnam((char)pportparity));
- printf(" /FLOW:%sn",
- pportflow == FLO_NONE ? "NONE" :
- (pportflow == FLO_RTSC ? "RTS/CTS" : "XON/XOFF")
- );
- } else
- printf(" /OUTPUT-ONLYn");
- #endif /* BPRINT */
- switch (printertype) {
- case PRT_NON: printf(" /NONEn"); break;
- case PRT_FIL: printf(" /FILEn"); break;
- case PRT_PIP: printf(" /PIPEn"); break;
- case PRT_DOS: printf(" /DOS-DEVICEn"); break;
- case PRT_WIN: printf(" /WINDOWS-QUEUEn"); break;
- }
- printf(" /TIMEOUT:%dn",printtimo);
- if (printterm) {
- printf(" /END-OF-JOB-STRING:");
- shostrdef(printterm);
- printf("n");
- } else
- printf(" /END-OF-JOB-STRING:(none)n");
- printf(" /JOB-HEADER-FILE:%sn",printsep ? printsep : "(none)");
- #endif /* PRINTSWI */
- printf("n");
- break;
- }
- case SHCMD:
- #ifdef CK_AUTODL
- printf(" Command autodownload: %sn",showoff(cmdadl));
- #else
- printf(" Command autodownload: (not available)n");
- #endif /* CK_AUTODL */
- printf(" Command bytesize: %d bitsn",
- (cmdmsk == 0377) ? 8 : 7);
- #ifdef CK_RECALL
- printf(" Command recall-buffer-size: %dn",cm_recall);
- #else
- printf(" Command recall-buffer not available in this versionn");
- #endif /* CK_RECALL */
- #ifdef CK_RECALL
- printf(" Command retry: %sn",showoff(cm_retry));
- #else
- printf(" Command retry not available in this versionn");
- #endif /* CK_RECALL */
- printf(" Command interruption: %sn", showoff(cmdint));
- printf(" Command quoting: %sn", showoff(cmdgquo()));
- printf(" Command more-prompting: %sn", showoff(xaskmore));
- printf(" Command height: %dn", cmd_rows);
- printf(" Command width: %dn", cmd_cols);
- printf(" Hints: %sn", showoff(hints));
- printf(" Quiet: %sn", showoff(quiet));
- printf(" Maximum command length: %dn", CMDBL);
- #ifndef NOSPL
- printf(" Maximum number of macros: %dn", MAC_MAX);
- printf(" Macros defined: %dn", nmac);
- printf(" Maximum macro depth: %dn", MACLEVEL);
- printf(" Maximum TAKE depth: %dn", MAXTAKE);
- #endif /* NOSPL */
- #ifdef UNIX
- #ifndef NOJC
- printf(" Suspend: %sn", showoff(suspend));
- #endif /* NOJC */
- #endif /* UNIX */
- break;
- #ifndef NOSPL
- case SHALRM:
- if (ck_alarm)
- printf("Alarm at %s %sn",alrm_date,alrm_time);
- else
- printf("(no alarm set)n");
- break;
- #endif /* NOSPL */
- #ifndef NOMSEND
- case SHSFL: {
- extern struct filelist * filehead;
- if (!filehead) {
- printf("send-list is emptyn");
- } else {
- struct filelist * flp;
- char * s;
- flp = filehead;
- while (flp) {
- s = flp->fl_alias;
- if (!s) s = "(none)";
- printf("%s, mode: %s, alias: %sn",
- flp->fl_name,
- gfmode(flp->fl_mode,0),
- s
- );
- flp = flp->fl_next;
- }
- }
- }
- break;
- #endif /* NOMSEND */
- #ifdef CKXXCHAR
- case SHDBL:
- shodbl();
- break;
- #endif /* CKXXCHAR */
- #ifndef NOPUSH
- #ifndef NOFRILLS
- case SHEDIT:
- if (!editor[0]) {
- s = getenv("EDITOR");
- if (s) ckstrncpy(editor,s,CKMAXPATH);
- }
- printf("n editor: %sn", editor[0] ? editor : "(none)");
- if (editor[0]) {
- printf(" options: %sn", editopts[0] ? editopts : "(none)");
- printf(" file: %sn", editfile[0] ? editfile : "(none)");
- }
- printf("n");
- break;
- #ifdef BROWSER
- case SHBROWSE:
- if (!browser[0]) {
- s = getenv("BROWSER");
- if (s) ckstrncpy(browser,s,CKMAXPATH);
- }
- printf("n browser: %sn", browser[0] ? browser : "(none)");
- if (browser[0]) {
- printf(" options: %sn", browsopts[0] ? browsopts : "(none)");
- printf(" url: %sn", browsurl[0] ? browsurl : "(none)");
- }
- printf("n");
- break;
- #endif /* BROWSER */
- #endif /* NOFRILLS */
- #endif /* NOPUSH */
- #ifndef NOLOCAL
- #ifdef CK_TAPI
- case SHTAPI: /* TAPI options */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotapi(0);
- break;
- case SHTAPI_L: /* TAPI Locations */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotapi(1);
- break;
- case SHTAPI_M: /* TAPI Modem */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotapi(2);
- break;
- case SHTAPI_C: /* TAPI Comm */
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- shotapi(3);
- break;
- #endif /* CK_TAPI */
- #ifdef TNCODE
- case SHTEL: /* TELNET */
- printf("n");
- shotel(0);
- printf("n");
- break;
- case SHTOPT: /* TELNET OPTIONS */
- printf("n");
- shotopt(0);
- printf("n");
- break;
- #endif /* TNCODE */
- #ifdef CK_TRIGGER
- case SHTRIG: {
- extern char * tt_trigger[], * triggerval;
- int i;
- if (!tt_trigger[0]) {
- printf(" Triggers: (none)n");
- } else {
- printf(" Triggers:n");
- for (i = 0; i < TRIGGERS; i++) {
- if (!tt_trigger[i])
- break;
- printf(" "%s"n",tt_trigger[i]);
- }
- printf(" Most recent trigger encountered: ");
- if (triggerval)
- printf(""%s"n",triggerval);
- else
- printf("(none)n");
- }
- break;
- }
- #endif /* CK_TRIGGER */
- #endif /* NOLOCAL */
- #ifndef NOSPL
- case SHINP:
- shoinput();
- break;
- #endif /* NOSPL */
- case SHLOG: {
- #ifndef MAC
- extern int xferlog;
- #ifdef IKSD
- if (inserver &&
- #ifdef CK_LOGIN
- isguest
- #else /* CK_LOGIN */
- 0
- #endif /* CK_LOGIN */
- ) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- #ifdef DEBUG
- printf("n Debug log: %sn", deblog ? debfil : "(none)");
- #endif /* DEBUG */
- #ifndef NOXFER
- printf(" Packet log: %sn", pktlog ? pktfil : "(none)");
- #endif /* NOXFER */
- #ifndef NOLOCAL
- printf(" Session log: %sn", seslog ? sesfil : "(none)");
- #endif /* NOLOCAL */
- #ifdef TLOG
- if (tralog || (xferlog && tlogfmt == 2)) {
- extern int tlogsep;
- printf(" Transaction log: %s (%s)",
- trafil,
- tlogfmt ?
- ((tlogfmt == 2) ? "ftp" : "verbose") :
- "brief"
- );
- if (tlogfmt == 0)
- printf(" (separator='%c')", (char)tlogsep);
- printf("nn");
- } else
- printf(" Transaction log: (none)n");
- #endif /* TLOG */
- #ifdef CKLOGDIAL
- printf(" Connection log: %sn", dialog ? diafil : "(none)");
- #endif /* CKLOGDIAL */
- printf("n");
- #endif /* MAC */
- break;
- }
- #ifndef NOSPL
- case SHOUTP: /* OUTPUT */
- shooutput();
- break;
- #endif /* NOSPL */
- #ifdef PATTERNS
- case SHOPAT: /* PATTERNS */
- shopat();
- break;
- #endif /* PATTERNS */
- #ifdef STREAMING
- case SHOSTR: { /* STREAMING */
- extern int streamrq, tsecs, clearrq, cleared;
- extern long tfc;
- extern long tfcps;
- printf("n Reliable: %sn",showooa(reliable));
- printf(" Clearchannel: %sn",showooa(clearrq));
- printf(" Streaming: %snn",showooa(streamrq));
- if (!local && streamrq == SET_ON ||
- streamrq == SET_AUTO && reliable)
- printf(" Streaming will be done if requested.n");
- else if (streamrq == SET_OFF || streamrq == SET_AUTO && !reliable)
- printf(" Streaming will not be requested and will not be done.n");
- else if (streamrq == SET_ON || streamrq == SET_AUTO && reliable)
- printf(
- " Streaming will be requested and will be done if the other Kermit agrees.n");
- printf(" Last transfer: %sstreaming%s, %ld cps.n",
- streamed > 0 ? "" : "no ",
- cleared ? ", clearchannel" : "",
- tfcps
- );
- printf("n");
- break;
- }
- #endif /* STREAMING */
- #ifdef CK_AUTHENTICATION
- case SHOAUTH:
- return(sho_auth(0));
- #endif /* CK_AUTHENTICATION */
- #ifdef BROWSER
- case SHOFTP: {
- extern char ftpapp[], ftpopts[];
- #ifdef IKSD
- if (inserver) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- printf("n ftp-client: %sn", ftpapp[0] ? ftpapp : "(none)");
- if (ftpapp[0]) {
- printf(" ftp options: %sn", ftpopts[0] ? ftpopts : "(none)");
- }
- printf("n");
- break;
- }
- #endif /* BROWSER */
- #ifndef NOCMDL
- case SHXOPT: {
- #ifdef IKSDB
- extern unsigned long mystate;
- extern int dbenabled;
- extern char * dbfile, * dbdir, myhexip[];
- extern unsigned long mypid;
- #endif /* IKSDB */
- #ifdef CKWTMP
- extern int ckxwtmp;
- extern char * wtmpfile;
- #endif /* CKWTMP */
- #ifdef CK_LOGIN
- extern int ckxanon, ckxpriv, ckxperms, xferlog, logintimo;
- extern char * xferfile;
- #endif /* CK_LOGIN */
- extern char * bannerfile, * helpfile;
- #ifdef IKSD
- if (inserver &&
- #ifdef CK_LOGIN
- isguest
- #else /* CK_LOGIN */
- 0
- #endif /* CK_LOGIN */
- ) {
- printf("Sorry, command disabled.rn");
- return(success = 0);
- }
- #endif /* IKSD */
- printf("n");
- if (!cmdint)
- printf(" --nointerruptsn");
- printf(" --bannerfile=%sn",bannerfile ? bannerfile : "(null)");
- printf(" --cdfile:%sn",cdmsgstr ? cdmsgstr : "(null)");
- printf(" --cdmessage:%dn",srvcdmsg);
- printf(" --helpfile:%dn",helpfile);
- if (inserver) {
- printf("n");
- break;
- }
- #ifdef CKSYSLOG
- #ifdef SYSLOGLEVEL
- printf(" --syslog:%d (forced)n",ckxsyslog);
- #else
- printf(" --syslog:%dn",ckxsyslog);
- #endif /* SYSLOGLEVEL */
- #endif /* CKSYSLOG */
- #ifdef CKWTMP
- printf(" --wtmplog:%dn",ckxwtmp);
- printf(" --wtmpfile=%sn",wtmpfile ? wtmpfile : "(null)");
- #endif /* CKWTMP */
- #ifdef IKSD
- #ifdef CK_LOGIN
- printf(" --anonymous:%dn",ckxanon);
- printf(" --privid:%dn",ckxpriv);
- printf(" --permission:%04on",ckxperms);
- printf(" --initfile:%sn",anonfile ? anonfile : "(null)");
- printf(" --userfile:%sn",userfile ? userfile : "(null)");
- printf(" --root:%sn",anonroot ? anonroot : "(null)");
- printf(" --xferlog=%dn",xferlog);
- printf(" --xferfile=%sn",xferfile ? xferfile : "(null)");
- printf(" --timeout=%dn",logintimo);
- #endif /* CK_LOGIN */
- #ifdef IKSDB
- printf(" --database=%dn",dbenabled);
- printf(" --dbfile=%sn",dbfile ? dbfile : "(null)");
- if (dbdir)
- printf(" (db directory=[%s])n",dbdir);
- #endif /* IKSDB */
- #ifdef IKSDCONF
- printf(" IKSD conf=%sn",iksdconf);
- #endif /* IKSDCONF */
- #endif /* IKSD */
- printf("n");
- break;
- }
- #endif /* NOCMDL */
- case SHCD:
- s = getenv("CDPATH");
- if (!s) s = "(none)";
- printf("n current directory: %sn", zgtdir());
- printf(" previous directory: %sn", prevdir ? prevdir : "(none)");
- printf(" cd path: %sn", ckcdpath ? ckcdpath : s);
- printf(" cd message: %sn", showoff(srvcdmsg & 2));
- printf(" server cd-message: %sn", showoff(srvcdmsg & 1));
- printf(" cd message file: %snn", cdmsgstr ? cdmsgstr : "(none)");
- break;
- #ifndef NOCSETS
- case SHASSOC:
- (VOID) showassoc();
- break;
- #endif /* NOCSETS */
- #ifdef CKLOGDIAL
- case SHCONNX:
- (VOID) dologshow(1);
- break;
- #endif /* CKLOGDIAL */
- case SHOPTS:
- optlines = 0;
- #ifndef NOFRILLS
- (VOID) showdelopts();
- #endif /* NOFRILLS */
- #ifdef DOMYDIR
- (VOID) showdiropts();
- #endif /* DOMYDIR */
- #ifdef CKPURGE
- (VOID) showpurgopts();
- #endif /* CKPURGE */
- (VOID) showtypopts();
- break;
- #ifndef NOLOCAL
- case SHOFLO:
- (VOID) shoflow();
- break;
- #endif /* NOLOCAL */
- #ifndef NOXFER
- case SHOXFER:
- (VOID) shoxfer();
- break;
- #endif /* NOXFER */
- default:
- printf("nNothing to show...n");
- return(-2);
- }
- return(success = 1);
- }
- #ifndef NOXFER
- int
- shoatt() {
- printf("Attributes: %sn", showoff(atcapr));
- if (!atcapr) return(0);
- printf(" Blocksize: %sn", showoff(atblki));
- printf(" Date: %sn", showoff(atdati));
- printf(" Disposition: %sn", showoff(atdisi));
- printf(" Encoding (Character Set): %sn", showoff(atenci));
- printf(" Length: %sn", showoff(atleni));
- printf(" Type (text/binary): %sn", showoff(attypi));
- printf(" System ID: %sn", showoff(atsidi));
- printf(" System Info: %sn", showoff(atsysi));
- #ifdef CK_PERMS
- printf(" Protection: %sn", showoff(atlpri));
- #endif /* CK_PERMS */
- #ifdef STRATUS
- printf(" Format: %sn", showoff(atfrmi));
- printf(" Creator: %sn", showoff(atcrei));
- printf(" Account: %sn", showoff(atacti));
- #endif /* STRATUS */
- return(0);
- }
- #endif /* NOXFER */
- #ifndef NOSPL
- int /* SHOW MACROS */
- shomac(s1, s2) char *s1, *s2; {
- int x, n, pp;
- pp = 0; /* Parenthesis counter */
- debug(F110,"shomac s1",s1,0);
- debug(F110,"shomac s2",s2,0);
- if (!s1)
- return(0);
- else
- printf("n%s = ",s1); /* Print blank line and macro name */
- slc++; /* Count the line */
- n = (int)strlen(s1) + 4; /* Width of current line */
- if (!s2) s2 = "(null definition)";
- while (x = *s2++) { /* Loop thru definition */
- if (x == '(') pp++; /* Treat commas within parens */
- if (x == ')') pp--; /* as ordinary text */
- if (pp < 0) pp = 0; /* Outside parens, */
- if (x == ',' && pp == 0) { /* comma becomes comma-dash-NL. */
- putchar(',');
- putchar('-');
- x = 'n';
- }
- putchar((CHAR)x); /* Output the character */
- if (x == 'n') { /* If it was a newline */
- #ifdef UNIX
- #ifdef NOSETBUF
- fflush(stdout);
- #endif /* NOSETBUF */
- #endif /* UNIX */
- putchar(' '); /* Indent the next line 1 space */
- while(*s2 == ' ') s2++; /* skip past leading blanks */
- n = 2; /* restart the character counter */