1 /*****************************************************************************
2 
3 	ExeCtT()
4 
5 	This function executes a ^T (control-T or caret-T) command.
6 
7 	^T	ASCII value of next char typed
8 	n^T	Types out character for ASCII code n.
9 
10 *****************************************************************************/
11 
12 #include "zport.h"		/* define portability identifiers */
13 #include "tecoc.h"		/* define general identifiers */
14 #include "defext.h"		/* define external global variables */
15 #include "deferr.h"		/* define identifiers for error messages */
16 
ExeCtT()17 DEFAULT ExeCtT()		/* execute a ^T (control-T) command */
18 {
19 	DEFAULT lchar;
20 
21 	DBGFEN(1,"ExeCtT",NULL);
22 
23 	if ((EStTop == EStBot) ||		    /* if no numeric arg or */
24 	    (EStack[EStTop].ElType != OPERAND)) {     /* partial expression */
25 	    lchar = ZChIn(EtFlag & ET_NO_WAIT);	      /* read a character */
26 	    if (GotCtC) {			      /* if got a control-C */
27 		DBGFEX(1,DbgFNm,"FAILURE");
28 		return FAILURE;
29 	    }
30 
31 	    if (((EtFlag & ET_NO_ECHO) == 0) && (lchar != -1)) {
32 		EchoIt((unsigned char)lchar);
33 	    }
34 
35 	    DBGFEX(1,DbgFNm,"PushEx()");
36 	    return PushEx((LONG)lchar, OPERAND);
37 	}
38 
39 	if (GetNmA() == FAILURE) {		/* get numeric arg */
40 	    DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
41 	    return FAILURE;
42 	}
43 
44 	if ((CmdMod & COLON) || (EtFlag & ET_IMAGE_MODE)) {
45 	    ZDspCh((char)NArgmt);
46 	} else {
47 	    EchoIt((unsigned char)NArgmt);
48 	}
49 
50 	CmdMod = '\0';				/* clear modifiers flags */
51 	DBGFEX(1,DbgFNm,"SUCCESS");
52 	return SUCCESS;
53 }
54