summaryrefslogtreecommitdiffstats
path: root/lib/libmytinfo/findcap.c
blob: 81ede3fd9735d0dcf833408413910f7d6228290d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * findcap.c
 *
 * By Ross Ridge
 * Public Domain
 * 92/02/01 07:29:55
 *
 */

#include "defs.h"
#include <term.h>

#include "bsearch.c"

#ifdef USE_SCCS_IDS
static const char SCCSid[] = "@(#) mytinfo findcap.c 3.2 92/02/01 public domain, By Ross Ridge";
#endif

extern char **_sboolcodes[], **_snumcodes[], **_sstrcodes[];
extern char **_sboolnames[], **_snumnames[], **_sstrnames[];
extern char **_sboolfnames[], **_snumfnames[], **_sstrfnames[];

static char **p2p2c;

int
_findboolcode(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sboolcodes,
				   NUM_OF_BOOLS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - boolcodes;
}

int
_findboolname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sboolnames,
				   NUM_OF_BOOLS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - boolnames;
}

int
_findboolfname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sboolfnames,
				   NUM_OF_BOOLS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - boolfnames;
}

int
_findnumcode(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _snumcodes,
				   NUM_OF_NUMS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - numcodes;
}

int
_findnumname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _snumnames,
				   NUM_OF_NUMS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - numnames;
}

int
_findnumfname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _snumfnames,
				   NUM_OF_NUMS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - numfnames;
}

int
_findstrcode(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sstrcodes,
				   NUM_OF_STRS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - strcodes;
}

int
_findstrname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sstrnames,
				   NUM_OF_STRS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - strnames;
}

int
_findstrfname(s)
char *s; {
	char ***match;

	p2p2c = &s;

	match = (char ***) bsearch((anyptr) &p2p2c, (anyptr) _sstrfnames,
				   NUM_OF_STRS, sizeof(p2p2c), _compar);
	if (match == NULL)
		return -1;
	return *match - strfnames;
}
OpenPOWER on IntegriCloud