xref: /illumos-gate/usr/src/lib/libcurses/screen/tifget.ed (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
1H
2!rm -f tifget.c
30a
4/*
5 * Routines to retrieve a value based on the short terminfo name.
6 * This file is created from tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
17.r !cat ./tmp/tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
26.r !cat ./tmp/tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
35.r !cat ./tmp/tifget.tmp
36!rm ./tmp/tifget.tmp
37.a
38		};
39
40/*
41 *  Return the value of the long-named boolean capability tistr.
42 *  Return -1 if the name is not a boolean capability.
43 */
44
45int
46tifgetflag(char *tistr)
47{
48	int	offset;
49	char	*bool_array = (char *) cur_bools;
50
51	return (((offset = _tcsearch(tistr, booloffsets, boolfnames,
52	    _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]);
53}
54
55/*
56 *  Return the value of the long-named numeric capability tistr.
57 *  Return -2 if the name is not a numeric capability.
58 */
59
60int
61tifgetnum(char *tistr)
62{
63	int	offset;
64	short	*num_array = (short *) cur_nums;
65
66	return (((offset = _tcsearch(tistr, numoffsets, numfnames,
67	    _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]);
68}
69
70/*
71 *  Return the value of the long-named string capability tistr.
72 *  Return (char *) -1 if the name is not a string capability.
73 */
74
75char	*
76tifgetstr(char *tistr)
77{
78	int	offset;
79	char	**str_array = (char **) cur_strs;
80
81	return (((offset = _tcsearch(tistr, stroffsets, strfnames,
82	    _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 :
83	    str_array[offset]);
84}
85.
860r copyright.h
871,.g/#pragma ident/d
88w tifget.c
89q
90