3 /* This file contains functions which simulate the termcap functions, but which
4 * can only describe the capabilities of the ANSI.SYS and NANSI.SYS drivers on
5 * an MS-DOS system or the VT-52 emulator of an Atari-ST. These functions
6 * do *NOT* access a "termcap" database file.
10 #if MSDOS || TOS || MINIX || COHERENT || UNIX
12 #define CAP(str) CAP2((str)[0], (str)[1])
13 #define CAP2(a,b) (((a) << 8) + ((b) & 0xff))
16 # define VAL2(v,a) (a)
17 # define VAL3(v,a,n) (nansi ? (n) : (a))
22 # define VAL2(v,a) (v)
23 # define VAL3(v,a,n) (v)
26 #if MINIX || COHERENT || UNIX
27 # define VAL2(v,a) (a)
28 # define VAL3(v,a,n) (n)
34 char *bp
; /* buffer for storing the entry -- ignored */
35 char *name
; /* name of the entry */
38 nansi
= strcmp(name
, "ansi");
48 case CAP2('l','i'): return 25;
49 case CAP2('c','o'): return 80;
50 case CAP2('s','g'): return 0;
51 case CAP2('u','g'): return 0;
61 #if !MINIX || COHERENT
62 case CAP2('a','m'): return 1;
64 case CAP2('b','s'): return 1;
65 case CAP2('m','i'): return 1;
73 char **bp
; /* pointer to pointer to buffer - ignored */
77 case CAP2('c','e'): return VAL2("\033K", "\033[K");
78 case CAP2('c','l'): return VAL2("\033E", "\033[2J");
80 case CAP2('a','l'): return VAL3("\033L", (char *)0, "\033[L");
81 case CAP2('d','l'): return VAL3("\033M", (char *)0, "\033[M");
83 case CAP2('c','m'): return VAL2("\033Y%i%+ %+ ", "\033[%i%d;%dH");
84 case CAP2('d','o'): return VAL2("\033B", "\033[B");
85 case CAP2('n','d'): return VAL2("\033C", "\033[C");
86 case CAP2('u','p'): return VAL2("\033A", "\033[A");
87 case CAP2('t','i'): return VAL2("\033e", "");
88 case CAP2('t','e'): return VAL2("", "");
90 case CAP2('s','o'): return VAL2("\033p", "\033[7m");
91 case CAP2('s','e'): return VAL2("\033q", "\033[m");
92 case CAP2('u','s'): return VAL2((char *)0, "\033[4m");
93 case CAP2('u','e'): return VAL2((char *)0, "\033[m");
94 case CAP2('m','d'): return VAL2((char *)0, "\033[1m");
95 case CAP2('m','e'): return VAL2((char *)0, "\033[m");
98 case CAP2('k','u'): return "\033[A";
99 case CAP2('k','d'): return "\033[B";
100 case CAP2('k','l'): return "\033[D";
101 case CAP2('k','r'): return "\033[C";
102 case CAP2('k','P'): return "\033[V";
103 case CAP2('k','N'): return "\033[U";
104 case CAP2('k','h'): return "\033[H";
106 case CAP2('k','H'): return "\033[Y";
107 # else /* COHERENT */
108 case CAP2('k','H'): return "\033[24H";
110 #else /* MS-DOS or TOS */
111 case CAP2('k','u'): return "#H";
112 case CAP2('k','d'): return "#P";
113 case CAP2('k','l'): return "#K";
114 case CAP2('k','r'): return "#M";
115 case CAP2('k','h'): return "#G";
116 case CAP2('k','H'): return "#O";
117 case CAP2('k','P'): return "#I";
118 case CAP2('k','N'): return "#Q";
121 default: return (char *)0;
126 char *tgoto(cm
, destcol
, destrow
)
127 char *cm
; /* cursor movement string -- ignored */
128 int destcol
;/* destination column, 0 - 79 */
129 int destrow
;/* destination row, 0 - 24 */
133 #if MSDOS || MINIX || COHERENT
134 sprintf(buf
, "\033[%d;%dH", destrow
+ 1, destcol
+ 1);
137 sprintf(buf
, "\033Y%c%c", ' ' + destrow
, ' ' + destcol
);
143 void tputs(cp
, affcnt
, outfn
)
144 char *cp
; /* the string to output */
145 int affcnt
; /* number of affected lines -- ignored */
146 int (*outfn
)(); /* the output function */