xref: /illumos-gate/usr/src/lib/libcurses/screen/tiget.ed (revision fc910014e8a32a65612105835a10995f2c13d942)
1H
2!rm -f tiget.c
30a
4/*
5 * Routines to retrieve a value based on the short terminfo name.
6 * This file is created from tiget.ed. DO NOT EDIT ME!
7 */
8
9#include	<sys/types.h>
10#include	"curses_inc.h"
11
12/* generated by sort on caps */
13static	short	booloffsets[] =
14		{
15.
16!sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
17.r !cat ./tmp/tiget.tmp
18.a
19		};
20
21/* generated by sort on caps */
22static	short	numoffsets[] =
23		{
24.
25!sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
26.r !cat ./tmp/tiget.tmp
27.a
28		};
29
30/* generated by sort on caps */
31static	short	stroffsets[] =
32		{
33.
34!sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
35.r !cat ./tmp/tiget.tmp
36!rm ./tmp/tiget.tmp
37.a
38		};
39
40/*
41 * Return the value of the boolean capability tistr.
42 * Return -1 if the name is not a boolean capability.
43 */
44
45int
46tigetflag(char *tistr)
47{
48	int	offset;
49	char	*bool_array = (char *) cur_bools;
50
51	return (((offset = _tcsearch(tistr, booloffsets, boolnames,
52	    _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]);
53}
54
55/*
56 * Return the value of the numeric capability tistr.
57 * Return -2 if the name is not a numeric capability.
58 */
59
60int
61tigetnum(char *tistr)
62{
63	int	offset;
64	short	*num_array = (short *) cur_nums;
65
66	return (((offset = _tcsearch(tistr, numoffsets, numnames,
67	    _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]);
68}
69
70/*
71 * Return the value of the string capability tistr.
72 * Return (char *) -1 if the name is not a string capability.
73 */
74
75char	*
76tigetstr(char *tistr)
77{
78	int	offset;
79	char	**str_array = (char **) cur_strs;
80
81	return (((offset = _tcsearch(tistr, stroffsets, strnames,
82	    _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 :
83	    str_array[offset]);
84}
85.
860r copyright.h
871,.g/#pragma ident/d
88w tiget.c
89q
90