xref: /titanic_50/usr/src/lib/libcurses/screen/tifget.ed (revision 174bc6499d233e329ecd3d98a880a7b07df16bfa)
1H
2!rm -f tifget.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 tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
19.r !cat ./tmp/tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
28.r !cat ./tmp/tifget.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", $1, i++}' | sort > ./tmp/tifget.tmp
37.r !cat ./tmp/tifget.tmp
38!rm ./tmp/tifget.tmp
39.a
40		};
41
42/*
43 *  Return the value of the long-named boolean capability tistr.
44 *  Return -1 if the name is not a boolean capability.
45 */
46
47int
48tifgetflag(char *tistr)
49{
50	int	offset;
51	char	*bool_array = (char *) cur_bools;
52
53	return (((offset = _tcsearch(tistr, booloffsets, boolfnames,
54	    _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]);
55}
56
57/*
58 *  Return the value of the long-named numeric capability tistr.
59 *  Return -2 if the name is not a numeric capability.
60 */
61
62int
63tifgetnum(char *tistr)
64{
65	int	offset;
66	short	*num_array = (short *) cur_nums;
67
68	return (((offset = _tcsearch(tistr, numoffsets, numfnames,
69	    _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]);
70}
71
72/*
73 *  Return the value of the long-named string capability tistr.
74 *  Return (char *) -1 if the name is not a string capability.
75 */
76
77char	*
78tifgetstr(char *tistr)
79{
80	int	offset;
81	char	**str_array = (char **) cur_strs;
82
83	return (((offset = _tcsearch(tistr, stroffsets, strfnames,
84	    _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 :
85	    str_array[offset]);
86}
87.
880r copyright.h
891,.g/#pragma ident/d
90w tifget.c
91q
92