1/*
2 * Copyright (c) 1989, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
9 *
10 * This code is derived from software contributed to Berkeley by
11 * Paul Borman at Krystal Technologies.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 * 4. Neither the name of the University nor the names of its contributors
22 *    may be used to endorse or promote products derived from this software
23 *    without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)isctype.c	8.3 (Berkeley) 2/24/94";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD$");
43
44#include <ctype.h>
45
46#undef digittoint
47int
48digittoint(c)
49	int c;
50{
51	return (__sbmaskrune(c, 0xFF));
52}
53
54#undef isalnum
55int
56isalnum(c)
57	int c;
58{
59	return (__sbistype(c, _CTYPE_A|_CTYPE_D));
60}
61
62#undef isalpha
63int
64isalpha(c)
65	int c;
66{
67	return (__sbistype(c, _CTYPE_A));
68}
69
70#undef isascii
71int
72isascii(c)
73	int c;
74{
75	return ((c & ~0x7F) == 0);
76}
77
78#undef isblank
79int
80isblank(c)
81	int c;
82{
83	return (__sbistype(c, _CTYPE_B));
84}
85
86#undef iscntrl
87int
88iscntrl(c)
89	int c;
90{
91	return (__sbistype(c, _CTYPE_C));
92}
93
94#undef isdigit
95int
96isdigit(c)
97	int c;
98{
99	return (__isctype(c, _CTYPE_D));
100}
101
102#undef isgraph
103int
104isgraph(c)
105	int c;
106{
107	return (__sbistype(c, _CTYPE_G));
108}
109
110#undef ishexnumber
111int
112ishexnumber(c)
113	int c;
114{
115	return (__sbistype(c, _CTYPE_X));
116}
117
118#undef isideogram
119int
120isideogram(c)
121	int c;
122{
123	return (__sbistype(c, _CTYPE_I));
124}
125
126#undef islower
127int
128islower(c)
129	int c;
130{
131	return (__sbistype(c, _CTYPE_L));
132}
133
134#undef isnumber
135int
136isnumber(c)
137	int c;
138{
139	return (__sbistype(c, _CTYPE_D));
140}
141
142#undef isphonogram
143int
144isphonogram(c)
145	int c;
146{
147	return (__sbistype(c, _CTYPE_Q));
148}
149
150#undef isprint
151int
152isprint(c)
153	int c;
154{
155	return (__sbistype(c, _CTYPE_R));
156}
157
158#undef ispunct
159int
160ispunct(c)
161	int c;
162{
163	return (__sbistype(c, _CTYPE_P));
164}
165
166#undef isrune
167int
168isrune(c)
169	int c;
170{
171	return (__sbistype(c, 0xFFFFFF00L));
172}
173
174#undef isspace
175int
176isspace(c)
177	int c;
178{
179	return (__sbistype(c, _CTYPE_S));
180}
181
182#undef isspecial
183int
184isspecial(c)
185	int c;
186{
187	return (__sbistype(c, _CTYPE_T));
188}
189
190#undef isupper
191int
192isupper(c)
193	int c;
194{
195	return (__sbistype(c, _CTYPE_U));
196}
197
198#undef isxdigit
199int
200isxdigit(c)
201	int c;
202{
203	return (__isctype(c, _CTYPE_X));
204}
205
206#undef toascii
207int
208toascii(c)
209	int c;
210{
211	return (c & 0x7F);
212}
213
214#undef tolower
215int
216tolower(c)
217	int c;
218{
219	return (__sbtolower(c));
220}
221
222#undef toupper
223int
224toupper(c)
225	int c;
226{
227	return (__sbtoupper(c));
228}
229
230