1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*	Copyright (c) 1988 AT&T	*/
26 /*	  All Rights Reserved	*/
27 
28 /*
29  * University Copyright- Copyright (c) 1982, 1986, 1988
30  * The Regents of the University of California
31  * All Rights Reserved
32  *
33  * University Acknowledgment- Portions of this document are derived from
34  * software developed by the University of California, Berkeley, and its
35  * contributors.
36  */
37 #pragma ident	"%Z%%M%	%I%	%E% SMI"
38 
39 /*
40  * Routines to retrieve a value based on the short terminfo name.
41  * This file is created from tiget.ed. DO NOT EDIT ME!
42  */
43 
44 #include	<sys/types.h>
45 #include	"curses_inc.h"
46 
47 /* generated by sort on caps */
48 static	short	booloffsets[] =
49 		{
50 	/* "am" */	1,
51 	/* "bce" */	28,
52 	/* "bw" */	0,
53 	/* "ccc" */	27,
54 	/* "chts" */	23,
55 	/* "cpix" */	35,
56 	/* "crxm" */	31,
57 	/* "da" */	11,
58 	/* "daisy" */	32,
59 	/* "db" */	12,
60 	/* "eo" */	5,
61 	/* "eslok" */	16,
62 	/* "gn" */	6,
63 	/* "hc" */	7,
64 	/* "hls" */	29,
65 	/* "hs" */	9,
66 	/* "hz" */	18,
67 	/* "in" */	10,
68 	/* "km" */	8,
69 	/* "lpix" */	36,
70 	/* "mc5i" */	22,
71 	/* "mir" */	13,
72 	/* "msgr" */	14,
73 	/* "ndscr" */	26,
74 	/* "npc" */	25,
75 	/* "nrrmc" */	24,
76 	/* "nxon" */	21,
77 	/* "os" */	15,
78 	/* "sam" */	34,
79 	/* "ul" */	19,
80 	/* "xenl" */	4,
81 	/* "xhp" */	3,
82 	/* "xhpa" */	30,
83 	/* "xon" */	20,
84 	/* "xsb" */	2,
85 	/* "xt" */	17,
86 	/* "xvpa" */	33,
87 		};
88 
89 /* generated by sort on caps */
90 static	short	numoffsets[] =
91 		{
92 	/* "bitwin" */	31,
93 	/* "bitype" */	32,
94 	/* "btns" */	30,
95 	/* "bufsz" */	16,
96 	/* "colors" */	13,
97 	/* "cols" */	0,
98 	/* "cps" */	28,
99 	/* "it" */	1,
100 	/* "lh" */	9,
101 	/* "lines" */	2,
102 	/* "lm" */	3,
103 	/* "lw" */	10,
104 	/* "ma" */	11,
105 	/* "maddr" */	19,
106 	/* "mcs" */	21,
107 	/* "mjump" */	20,
108 	/* "mls" */	22,
109 	/* "ncv" */	15,
110 	/* "nlab" */	8,
111 	/* "npins" */	23,
112 	/* "orc" */	24,
113 	/* "orhi" */	26,
114 	/* "orl" */	25,
115 	/* "orvi" */	27,
116 	/* "pairs" */	14,
117 	/* "pb" */	5,
118 	/* "spinh" */	18,
119 	/* "spinv" */	17,
120 	/* "vt" */	6,
121 	/* "widcs" */	29,
122 	/* "wnum" */	12,
123 	/* "wsl" */	7,
124 	/* "xmc" */	4,
125 		};
126 
127 /* generated by sort on caps */
128 static	short	stroffsets[] =
129 		{
130 	/* "acsc" */	146,
131 	/* "bel" */	1,
132 	/* "bicr" */	372,
133 	/* "binel" */	371,
134 	/* "birep" */	370,
135 	/* "blink" */	26,
136 	/* "bold" */	27,
137 	/* "cbt" */	0,
138 	/* "chr" */	306,
139 	/* "civis" */	13,
140 	/* "clear" */	5,
141 	/* "cmdch" */	9,
142 	/* "cnorm" */	16,
143 	/* "colornm" */	373,
144 	/* "cpi" */	304,
145 	/* "cr" */	2,
146 	/* "csin" */	363,
147 	/* "csnm" */	354,
148 	/* "csr" */	3,
149 	/* "cub" */	111,
150 	/* "cub1" */	14,
151 	/* "cud" */	107,
152 	/* "cud1" */	11,
153 	/* "cuf" */	112,
154 	/* "cuf1" */	17,
155 	/* "cup" */	10,
156 	/* "cuu" */	114,
157 	/* "cuu1" */	19,
158 	/* "cvr" */	307,
159 	/* "cvvis" */	20,
160 	/* "cwin" */	277,
161 	/* "dch" */	105,
162 	/* "dch1" */	21,
163 	/* "dclk" */	275,
164 	/* "defbi" */	374,
165 	/* "defc" */	308,
166 	/* "devt" */	362,
167 	/* "dial" */	280,
168 	/* "dim" */	30,
169 	/* "dispc" */	378,
170 	/* "dl" */	106,
171 	/* "dl1" */	22,
172 	/* "docr" */	352,
173 	/* "dsl" */	23,
174 	/* "ech" */	37,
175 	/* "ed" */	7,
176 	/* "ehhlm" */	386,
177 	/* "el" */	6,
178 	/* "el1" */	269,
179 	/* "elhlm" */	387,
180 	/* "elohlm" */	388,
181 	/* "enacs" */	155,
182 	/* "endbi" */	375,
183 	/* "erhlm" */	389,
184 	/* "ethlm" */	390,
185 	/* "evhlm" */	391,
186 	/* "ff" */	46,
187 	/* "flash" */	45,
188 	/* "fln" */	273,
189 	/* "fsl" */	47,
190 	/* "getm" */	358,
191 	/* "hd" */	24,
192 	/* "home" */	12,
193 	/* "hook" */	284,
194 	/* "hpa" */	8,
195 	/* "ht" */	134,
196 	/* "hts" */	132,
197 	/* "hu" */	137,
198 	/* "hup" */	279,
199 	/* "ich" */	108,
200 	/* "ich1" */	52,
201 	/* "if" */	51,
202 	/* "il" */	110,
203 	/* "il1" */	53,
204 	/* "ind" */	129,
205 	/* "indn" */	109,
206 	/* "initc" */	299,
207 	/* "initp" */	300,
208 	/* "invis" */	32,
209 	/* "ip" */	54,
210 	/* "iprog" */	138,
211 	/* "is1" */	48,
212 	/* "is2" */	49,
213 	/* "is3" */	50,
214 	/* "kBEG" */	186,
215 	/* "kCAN" */	187,
216 	/* "kCMD" */	188,
217 	/* "kCPY" */	189,
218 	/* "kCRT" */	190,
219 	/* "kDC" */	191,
220 	/* "kDL" */	192,
221 	/* "kEND" */	194,
222 	/* "kEOL" */	195,
223 	/* "kEXT" */	196,
224 	/* "kFND" */	197,
225 	/* "kHLP" */	198,
226 	/* "kHOM" */	199,
227 	/* "kIC" */	200,
228 	/* "kLFT" */	201,
229 	/* "kMOV" */	203,
230 	/* "kMSG" */	202,
231 	/* "kNXT" */	204,
232 	/* "kOPT" */	205,
233 	/* "kPRT" */	207,
234 	/* "kPRV" */	206,
235 	/* "kRDO" */	208,
236 	/* "kRES" */	211,
237 	/* "kRIT" */	210,
238 	/* "kRPL" */	209,
239 	/* "kSAV" */	212,
240 	/* "kSPD" */	213,
241 	/* "kUND" */	214,
242 	/* "ka1" */	139,
243 	/* "ka3" */	140,
244 	/* "kb2" */	141,
245 	/* "kbeg" */	158,
246 	/* "kbs" */	55,
247 	/* "kc1" */	142,
248 	/* "kc3" */	143,
249 	/* "kcan" */	159,
250 	/* "kcbt" */	148,
251 	/* "kclo" */	160,
252 	/* "kclr" */	57,
253 	/* "kcmd" */	161,
254 	/* "kcpy" */	162,
255 	/* "kcrt" */	163,
256 	/* "kctab" */	58,
257 	/* "kcub1" */	79,
258 	/* "kcud1" */	61,
259 	/* "kcuf1" */	83,
260 	/* "kcuu1" */	87,
261 	/* "kdch1" */	59,
262 	/* "kdl1" */	60,
263 	/* "ked" */	64,
264 	/* "kel" */	63,
265 	/* "kend" */	164,
266 	/* "kent" */	165,
267 	/* "kext" */	166,
268 	/* "kf0" */	65,
269 	/* "kf1" */	66,
270 	/* "kf10" */	67,
271 	/* "kf11" */	216,
272 	/* "kf12" */	217,
273 	/* "kf13" */	218,
274 	/* "kf14" */	219,
275 	/* "kf15" */	220,
276 	/* "kf16" */	221,
277 	/* "kf17" */	222,
278 	/* "kf18" */	223,
279 	/* "kf19" */	224,
280 	/* "kf2" */	68,
281 	/* "kf20" */	225,
282 	/* "kf21" */	226,
283 	/* "kf22" */	227,
284 	/* "kf23" */	228,
285 	/* "kf24" */	229,
286 	/* "kf25" */	230,
287 	/* "kf26" */	231,
288 	/* "kf27" */	232,
289 	/* "kf28" */	233,
290 	/* "kf29" */	234,
291 	/* "kf3" */	69,
292 	/* "kf30" */	235,
293 	/* "kf31" */	236,
294 	/* "kf32" */	237,
295 	/* "kf33" */	238,
296 	/* "kf34" */	239,
297 	/* "kf35" */	240,
298 	/* "kf36" */	241,
299 	/* "kf37" */	242,
300 	/* "kf38" */	243,
301 	/* "kf39" */	244,
302 	/* "kf4" */	70,
303 	/* "kf40" */	245,
304 	/* "kf41" */	246,
305 	/* "kf42" */	247,
306 	/* "kf43" */	248,
307 	/* "kf44" */	249,
308 	/* "kf45" */	250,
309 	/* "kf46" */	251,
310 	/* "kf47" */	252,
311 	/* "kf48" */	253,
312 	/* "kf49" */	254,
313 	/* "kf5" */	71,
314 	/* "kf50" */	255,
315 	/* "kf51" */	256,
316 	/* "kf52" */	257,
317 	/* "kf53" */	258,
318 	/* "kf54" */	259,
319 	/* "kf55" */	260,
320 	/* "kf56" */	261,
321 	/* "kf57" */	262,
322 	/* "kf58" */	263,
323 	/* "kf59" */	264,
324 	/* "kf6" */	72,
325 	/* "kf60" */	265,
326 	/* "kf61" */	266,
327 	/* "kf62" */	267,
328 	/* "kf63" */	268,
329 	/* "kf7" */	73,
330 	/* "kf8" */	74,
331 	/* "kf9" */	75,
332 	/* "kfnd" */	167,
333 	/* "khlp" */	168,
334 	/* "khome" */	76,
335 	/* "khts" */	86,
336 	/* "kich1" */	77,
337 	/* "kil1" */	78,
338 	/* "kind" */	84,
339 	/* "kll" */	80,
340 	/* "kmous" */	355,
341 	/* "kmov" */	171,
342 	/* "kmrk" */	169,
343 	/* "kmsg" */	170,
344 	/* "knp" */	81,
345 	/* "knxt" */	172,
346 	/* "kopn" */	173,
347 	/* "kopt" */	174,
348 	/* "kpp" */	82,
349 	/* "kprt" */	176,
350 	/* "kprv" */	175,
351 	/* "krdo" */	177,
352 	/* "kref" */	178,
353 	/* "kres" */	182,
354 	/* "krfr" */	179,
355 	/* "kri" */	85,
356 	/* "krmir" */	62,
357 	/* "krpl" */	180,
358 	/* "krst" */	181,
359 	/* "ksav" */	183,
360 	/* "kslt" */	193,
361 	/* "kspd" */	184,
362 	/* "ktbc" */	56,
363 	/* "kund" */	185,
364 	/* "lf0" */	90,
365 	/* "lf1" */	91,
366 	/* "lf10" */	92,
367 	/* "lf2" */	93,
368 	/* "lf3" */	94,
369 	/* "lf4" */	95,
370 	/* "lf5" */	96,
371 	/* "lf6" */	97,
372 	/* "lf7" */	98,
373 	/* "lf8" */	99,
374 	/* "lf9" */	100,
375 	/* "ll" */	18,
376 	/* "lpi" */	305,
377 	/* "mc0" */	118,
378 	/* "mc4" */	119,
379 	/* "mc5" */	120,
380 	/* "mc5p" */	144,
381 	/* "mcub" */	336,
382 	/* "mcub1" */	330,
383 	/* "mcud" */	335,
384 	/* "mcud1" */	329,
385 	/* "mcuf" */	337,
386 	/* "mcuf1" */	331,
387 	/* "mcuu" */	338,
388 	/* "mcuu1" */	333,
389 	/* "mgc" */	270,
390 	/* "mhpa" */	328,
391 	/* "minfo" */	356,
392 	/* "mrcup" */	15,
393 	/* "mvpa" */	332,
394 	/* "nel" */	103,
395 	/* "oc" */	298,
396 	/* "op" */	297,
397 	/* "pad" */	104,
398 	/* "pause" */	285,
399 	/* "pctrm" */	383,
400 	/* "pfkey" */	115,
401 	/* "pfloc" */	116,
402 	/* "pfx" */	117,
403 	/* "pfxl" */	361,
404 	/* "pln" */	147,
405 	/* "porder" */	334,
406 	/* "prot" */	33,
407 	/* "pulse" */	283,
408 	/* "qdial" */	281,
409 	/* "rbim" */	348,
410 	/* "rc" */	126,
411 	/* "rcsd" */	349,
412 	/* "rep" */	121,
413 	/* "reqmp" */	357,
414 	/* "rev" */	34,
415 	/* "rf" */	125,
416 	/* "rfi" */	215,
417 	/* "ri" */	130,
418 	/* "rin" */	113,
419 	/* "ritm" */	321,
420 	/* "rlm" */	322,
421 	/* "rmacs" */	38,
422 	/* "rmam" */	152,
423 	/* "rmclk" */	276,
424 	/* "rmcup" */	40,
425 	/* "rmdc" */	41,
426 	/* "rmicm" */	323,
427 	/* "rmir" */	42,
428 	/* "rmkx" */	88,
429 	/* "rmln" */	157,
430 	/* "rmm" */	101,
431 	/* "rmp" */	145,
432 	/* "rmpch" */	380,
433 	/* "rmsc" */	382,
434 	/* "rmso" */	43,
435 	/* "rmul" */	44,
436 	/* "rmxon" */	150,
437 	/* "rs1" */	122,
438 	/* "rs2" */	123,
439 	/* "rs3" */	124,
440 	/* "rshm" */	324,
441 	/* "rsubm" */	325,
442 	/* "rsupm" */	326,
443 	/* "rum" */	327,
444 	/* "rwidm" */	320,
445 	/* "s0ds" */	364,
446 	/* "s1ds" */	365,
447 	/* "s2ds" */	366,
448 	/* "s3ds" */	367,
449 	/* "sbim" */	346,
450 	/* "sc" */	128,
451 	/* "scesa" */	385,
452 	/* "scesc" */	384,
453 	/* "sclk" */	274,
454 	/* "scp" */	301,
455 	/* "scs" */	339,
456 	/* "scsd" */	347,
457 	/* "sdrfq" */	310,
458 	/* "setab" */	360,
459 	/* "setaf" */	359,
460 	/* "setb" */	303,
461 	/* "setcolor" */	376,
462 	/* "setf" */	302,
463 	/* "sgr" */	131,
464 	/* "sgr0" */	39,
465 	/* "sgr1" */	392,
466 	/* "sitm" */	311,
467 	/* "slength" */	393,
468 	/* "slines" */	377,
469 	/* "slm" */	312,
470 	/* "smacs" */	25,
471 	/* "smam" */	151,
472 	/* "smcup" */	28,
473 	/* "smdc" */	29,
474 	/* "smgb" */	340,
475 	/* "smgbp" */	341,
476 	/* "smgl" */	271,
477 	/* "smglp" */	342,
478 	/* "smglr" */	368,
479 	/* "smgr" */	272,
480 	/* "smgrp" */	343,
481 	/* "smgt" */	344,
482 	/* "smgtb" */	369,
483 	/* "smgtp" */	345,
484 	/* "smicm" */	313,
485 	/* "smir" */	31,
486 	/* "smkx" */	89,
487 	/* "smln" */	156,
488 	/* "smm" */	102,
489 	/* "smpch" */	379,
490 	/* "smsc" */	381,
491 	/* "smso" */	35,
492 	/* "smul" */	36,
493 	/* "smxon" */	149,
494 	/* "snlq" */	314,
495 	/* "snrmq" */	315,
496 	/* "sshm" */	316,
497 	/* "ssubm" */	317,
498 	/* "ssupm" */	318,
499 	/* "subcs" */	350,
500 	/* "sum" */	319,
501 	/* "supcs" */	351,
502 	/* "swidm" */	309,
503 	/* "tbc" */	4,
504 	/* "tone" */	282,
505 	/* "tsl" */	135,
506 	/* "u0" */	287,
507 	/* "u1" */	288,
508 	/* "u2" */	289,
509 	/* "u3" */	290,
510 	/* "u4" */	291,
511 	/* "u5" */	292,
512 	/* "u6" */	293,
513 	/* "u7" */	294,
514 	/* "u8" */	295,
515 	/* "u9" */	296,
516 	/* "uc" */	136,
517 	/* "vpa" */	127,
518 	/* "wait" */	286,
519 	/* "wind" */	133,
520 	/* "wingo" */	278,
521 	/* "xoffc" */	154,
522 	/* "xonc" */	153,
523 	/* "zerom" */	353,
524 		};
525 
526 /*
527  * Return the value of the boolean capability tistr.
528  * Return -1 if the name is not a boolean capability.
529  */
530 
531 int
532 tigetflag(char *tistr)
533 {
534 	int	offset;
535 	char	*bool_array = (char *) cur_bools;
536 
537 	return (((offset = _tcsearch(tistr, booloffsets, boolnames,
538 	    _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]);
539 }
540 
541 /*
542  * Return the value of the numeric capability tistr.
543  * Return -2 if the name is not a numeric capability.
544  */
545 
546 int
547 tigetnum(char *tistr)
548 {
549 	int	offset;
550 	short	*num_array = (short *) cur_nums;
551 
552 	return (((offset = _tcsearch(tistr, numoffsets, numnames,
553 	    _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]);
554 }
555 
556 /*
557  * Return the value of the string capability tistr.
558  * Return (char *) -1 if the name is not a string capability.
559  */
560 
561 char	*
562 tigetstr(char *tistr)
563 {
564 	int	offset;
565 	char	**str_array = (char **) cur_strs;
566 
567 	return (((offset = _tcsearch(tistr, stroffsets, strnames,
568 	    _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 :
569 	    str_array[offset]);
570 }
571