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(int c)
49{
50	return (__sbmaskrune(c, 0xFF));
51}
52
53#undef isalnum
54int
55isalnum(int c)
56{
57	return (__sbistype(c, _CTYPE_A|_CTYPE_N));
58}
59
60#undef isalpha
61int
62isalpha(int c)
63{
64	return (__sbistype(c, _CTYPE_A));
65}
66
67#undef isascii
68int
69isascii(int c)
70{
71	return ((c & ~0x7F) == 0);
72}
73
74#undef isblank
75int
76isblank(int c)
77{
78	return (__sbistype(c, _CTYPE_B));
79}
80
81#undef iscntrl
82int
83iscntrl(int c)
84{
85	return (__sbistype(c, _CTYPE_C));
86}
87
88#undef isdigit
89int
90isdigit(int c)
91{
92	return (__isctype(c, _CTYPE_D));
93}
94
95#undef isgraph
96int
97isgraph(int c)
98{
99	return (__sbistype(c, _CTYPE_G));
100}
101
102#undef ishexnumber
103int
104ishexnumber(int c)
105{
106	return (__sbistype(c, _CTYPE_X));
107}
108
109#undef isideogram
110int
111isideogram(int c)
112{
113	return (__sbistype(c, _CTYPE_I));
114}
115
116#undef islower
117int
118islower(int c)
119{
120	return (__sbistype(c, _CTYPE_L));
121}
122
123#undef isnumber
124int
125isnumber(int c)
126{
127	return (__sbistype(c, _CTYPE_N));
128}
129
130#undef isphonogram
131int
132isphonogram(int c)
133{
134	return (__sbistype(c, _CTYPE_Q));
135}
136
137#undef isprint
138int
139isprint(int c)
140{
141	return (__sbistype(c, _CTYPE_R));
142}
143
144#undef ispunct
145int
146ispunct(int c)
147{
148	return (__sbistype(c, _CTYPE_P));
149}
150
151#undef isrune
152int
153isrune(int c)
154{
155	return (__sbistype(c, 0xFFFFFF00L));
156}
157
158#undef isspace
159int
160isspace(int c)
161{
162	return (__sbistype(c, _CTYPE_S));
163}
164
165#undef isspecial
166int
167isspecial(int c)
168{
169	return (__sbistype(c, _CTYPE_T));
170}
171
172#undef isupper
173int
174isupper(int c)
175{
176	return (__sbistype(c, _CTYPE_U));
177}
178
179#undef isxdigit
180int
181isxdigit(int c)
182{
183	return (__isctype(c, _CTYPE_X));
184}
185
186#undef toascii
187int
188toascii(int c)
189{
190	return (c & 0x7F);
191}
192
193#undef tolower
194int
195tolower(int c)
196{
197	return (__sbtolower(c));
198}
199
200#undef toupper
201int
202toupper(int c)
203{
204	return (__sbtoupper(c));
205}
206
207