1 /* $DragonFly: src/usr.sbin/pcvt/vttest/Attic/esc.c,v 1.2 2005/02/20 17:19:11 asmodai Exp $ */
10 printf("%c%s", 27, s);
13 esc2(s1, s2) char s1, s2; {
14 printf("%c%s%s", 27, s1, s2);
17 brcstr(ps, c) char *ps, c; {
18 printf("%c[%s%c", 27, ps, c);
21 brc(pn,c) int pn; char c; {
22 printf("%c[%d%c", 27, pn, c);
25 brc2(pn1, pn2 ,c) int pn1, pn2; char c; {
26 printf("%c[%d;%d%c", 27, pn1, pn2, c);
29 cub(pn) int pn; { /* Cursor Backward */
32 cud(pn) int pn; { /* Cursor Down */
35 cuf(pn) int pn; { /* Cursor Forward */
38 cup(pn1, pn2) int pn1, pn2; { /* Cursor Position */
41 cuu(pn) int pn; { /* Cursor Up */
44 da() { /* Device Attributes */
47 decaln() { /* Screen Alignment Display */
50 decdhl(lower) int lower; { /* Double Height Line (also double width) */
54 decdwl() { /* Double Wide Line */
57 deckpam() { /* Keypad Application Mode */
60 deckpnm() { /* Keypad Numeric Mode */
63 decll(ps) char *ps; { /* Load LEDs */
66 decrc() { /* Restore Cursor */
69 decreqtparm(pn) int pn; { /* Request Terminal Parameters */
72 decsc() { /* Save Cursor */
75 decstbm(pn1, pn2) int pn1, pn2; { /* Set Top and Bottom Margins */
76 if (pn1 || pn2) brc2(pn1, pn2, 'r');
78 /* Good for >24-line terminals */
80 decswl() { /* Single With Line */
83 dectst(pn) int pn; { /* Invoke Confidence Test */
86 dsr(pn) int pn; { /* Device Status Report */
89 ed(pn) int pn; { /* Erase in Display */
92 el(pn) int pn; { /* Erase in Line */
95 hts() { /* Horizontal Tabulation Set */
98 hvp(pn1, pn2) int pn1, pn2; { /* Horizontal and Vertical Position */
104 nel() { /* Next Line */
107 ri() { /* Reverse Index */
110 ris() { /* Reset to Initial State */
113 rm(ps) char *ps; { /* Reset Mode */
116 scs(g,c) int g; char c; { /* Select character Set */
117 printf("%c%c%c%c%c%c%c", 27, g ? ')' : '(', c,
118 27, g ? '(' : ')', 'B',
121 sgr(ps) char *ps; { /* Select Graphic Rendition */
124 sm(ps) char *ps; { /* Set Mode */
127 tbc(pn) int pn; { /* Tabulation Clear */
131 vt52cup(l,c) int l,c; {
132 printf("%cY%c%c", 27, l + 31, c + 31);
138 * Wait until a character is typed on the terminal
139 * then read it, without waiting for CR.
142 int lval, waittime, getpid(); static int val; char ch;
154 if ((val==0177) && (val==lval))
155 kill(getpid(), (int) SIGTERM);
162 * Get an unfinished string from the terminal:
163 * wait until a character is typed on the terminal,
164 * then read it, and all other available characters.
165 * Return a pointer to that string.
169 int i, val, crflag; long l1; char ch;
170 static char result[80];
173 result[i++] = inchar();
174 /* Wait 0.1 seconds (1 second in vanilla UNIX) */
177 while(ioctl(0,FIONREAD,&l1), l1 > 0L) {
180 if (i++ == 78) goto out1;
188 ttybin(bin) int bin; {
192 trmop(fc,arg) int fc, arg; {
195 inputline(s) char *s; {
202 * Flush input buffer, make sure no pending input character
208 ioctl (0, FIONREAD, &l1);
209 while(l1-- > 0L) read(0,&val,1);
215 * Sleep and do nothing (don't waste CPU) for t milliseconds
220 sleep(t); /* UNIX can only sleep whole seconds */