3 char *CL
, *CM
, *CS
, *SR
;
6 char *tgetstr(), *getenv();
7 void PutStr(), CPutStr(), CCPutStr(), GotoPos(), RETURN();
13 char tcstr
[1024], *tp
;
15 if ((term
= getenv("TERM")) == 0)
17 fprintf(stderr
, "No $TERM set\n");
20 switch (tgetent(tcbuf
, term
))
23 fprintf(stderr
, "Could not open termcap file\n");
26 fprintf(stderr
, "I don't know what a '%s' terminal is.\n", term
);
30 if ((CL
= tgetstr("cl", &tp
)) == 0)
32 fprintf(stderr
, "cl capability required\n");
35 if ((CM
= tgetstr("cm", &tp
)) == 0)
37 fprintf(stderr
, "cm capability required\n");
41 if ((s
= getenv("COLUMNS")))
43 if ((s
= getenv("LINES")))
54 printf("******* cl capability does not work !!! *******");
57 printf("******* cl capability does not home cursor *******");
61 printf("******* cm capability does not work !!! *******");
64 GotoPos(CO
/2-12, LI
/2);
65 printf("Your terminal size is");
66 GotoPos(CO
/2-3, LI
/2+1);
67 printf("%dx%d", CO
, LI
);
70 GotoPos(CO
/2-3, LI
-1);
72 GotoPos(0, LI
/2-2);printf("l");
73 GotoPos(0, LI
/2-1);printf("e");
74 GotoPos(0, LI
/2+0);printf("f");
75 GotoPos(0, LI
/2+1);printf("t");
76 GotoPos(CO
-1, LI
/2-2);printf("r");
77 GotoPos(CO
-1, LI
/2-1);printf("i");
78 GotoPos(CO
-1, LI
/2+0);printf("g");
79 GotoPos(CO
-1, LI
/2+1);printf("h");
80 GotoPos(CO
-1, LI
/2+2);printf("t");
81 GotoPos(CO
/2-15, LI
/2+3);
84 printf("Termcap: terminal does %sauto-wrap", AM
? "" : "not ");
88 printf(" am capability set, but terminal does not wrap");
93 printf(" am capability not set, but terminal does wrap");
102 printf("Termcap: terminal has %smagic margins", XN
? "" : "no ");
104 if ((XN
= tgetflag("xn")))
106 printf(" xn capability set, but terminal has no magic-margins");
111 printf(" xn capability not set, but terminal has magic-margins");
121 printf(" last col in last row is not usable");
127 printf("testing magic margins in last row");
132 if ((CS
= tgetstr("cs", &tp
)))
134 printf("Termcap: terminal has scrollregions");
136 printf(" cs capability set, but doesn't work");
140 CCPutStr(CS
, 0, LI
-1);
144 if ((SR
= tgetstr("sr", &tp
)))
147 printf(" sr capability set, but doesn't work");
153 printf("Termcap: terminal can scroll backwards");
178 tputs(tgoto(s
, 0, c
), 1, putcha
);
182 void CCPutStr(s
, x
, y
)
186 tputs(tgoto(s
, y
, x
), 1, putcha
);
193 tputs(tgoto(CM
, x
, y
), 1, putcha
);
200 printf("Press <RETURN> to continue");
202 while(getchar() != '\n');