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