1 /*****************************************************************************
2
3 ExeT()
4
5 This function executes a T command.
6
7 nT Type n lines
8 m,nT Type from m to n
9 *****************************************************************************/
10
11 #include "zport.h" /* define portability identifiers */
12 #include "tecoc.h" /* define general identifiers */
13 #include "defext.h" /* define external global variables */
14 #include "dchars.h" /* define identifiers for characters */
15
ExeT()16 DEFAULT ExeT() /* execute T command */
17 {
18 DBGFEN(1,"ExeT",NULL);
19 if (EStTop == EStBot) { /* if no numeric argument */
20 NArgmt = 1; /* default is 1T */
21 } else {
22 UMinus(); /* if it's -T, make it -1T */
23 if (GetNmA() == FAILURE) { /* get numeric argument */
24 DBGFEX(1,DbgFNm,"FAILURE");
25 return FAILURE;
26 }
27 }
28
29 if (CmdMod & MARGIS) { /* if it's m,nT */
30 if (NArgmt != MArgmt) {
31 MEMMOVE(ErrTxt, "m,nT", 5);
32 if (GetAra() == FAILURE) {
33 DBGFEX(1,DbgFNm,"FAILURE");
34 return FAILURE;
35 }
36
37 /*
38 * if the area to type out is split by the buffer gap, we have to display
39 * each half separately.
40 */
41
42 if ((AraBeg < GapBeg) && (AraEnd > GapEnd)) {
43 TypBuf(AraBeg, GapBeg);
44 TypBuf(GapEnd+1, AraEnd+1);
45 } else {
46 TypBuf(AraBeg, AraEnd+1);
47 }
48 }
49 } else { /* else it's nT */
50 if (NArgmt <= 0) {
51 TypBuf(GapBeg+Ln2Chr(NArgmt), GapBeg);
52 } else {
53 TypBuf(GapEnd+1, GapEnd+Ln2Chr(NArgmt)+1);
54 }
55 }
56 CmdMod = '\0'; /* clear modifiers flags */
57
58 DBGFEX(1,DbgFNm,"SUCCESS");
59 return SUCCESS;
60 }
61