Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libc / locale / isctype.c
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  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgement:
23  *      This product includes software developed by the University of
24  *      California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  * $FreeBSD: src/lib/libc/locale/isctype.c,v 1.7 2000/02/08 07:43:24 obrien Exp $
42  */
43
44 #if defined(LIBC_SCCS) && !defined(lint)
45 static char sccsid[] = "@(#)isctype.c   8.3 (Berkeley) 2/24/94";
46 #endif /* LIBC_SCCS and not lint */
47
48 #include <ctype.h>
49
50 #undef digittoint
51 int
52 digittoint(c)
53         int c;
54 {
55         return (__maskrune((c), 0xFF));
56 }
57
58 #undef isalnum
59 int
60 isalnum(c)
61         int c;
62 {
63         return (__istype((c), _CTYPE_A|_CTYPE_D));
64 }
65
66 #undef isalpha
67 int
68 isalpha(c)
69         int c;
70 {
71         return (__istype((c), _CTYPE_A));
72 }
73
74 #undef isascii
75 int
76 isascii(c)
77         int c;
78 {
79         return (((c) & ~0x7F) == 0);
80 }
81
82 #undef isblank
83 int
84 isblank(c)
85         int c;
86 {
87         return (__istype((c), _CTYPE_B));
88 }
89
90 #undef iscntrl
91 int
92 iscntrl(c)
93         int c;
94 {
95         return (__istype((c), _CTYPE_C));
96 }
97
98 #undef isdigit
99 int
100 isdigit(c)
101         int c;
102 {
103         return (__isctype((c), _CTYPE_D));
104 }
105
106 #undef isgraph
107 int
108 isgraph(c)
109         int c;
110 {
111         return (__istype((c), _CTYPE_G));
112 }
113
114 #undef ishexnumber 
115 int
116 ishexnumber(c)
117         int c;
118 {
119         return (__istype((c), _CTYPE_X));
120 }
121
122 #undef isideogram
123 int
124 isideogram(c)
125         int c;
126 {
127         return (__istype((c), _CTYPE_I));
128 }
129
130 #undef islower
131 int
132 islower(c)
133         int c;
134 {
135         return (__istype((c), _CTYPE_L));
136 }
137
138 #undef isnumber
139 int
140 isnumber(c)
141         int c;
142 {
143         return (__istype((c), _CTYPE_D));
144 }
145
146 #undef isphonogram      
147 int
148 isphonogram(c)
149         int c;
150 {
151         return (__istype((c), _CTYPE_Q));
152 }
153
154 #undef isprint
155 int
156 isprint(c)
157         int c;
158 {
159         return (__istype((c), _CTYPE_R));
160 }
161
162 #undef ispunct
163 int
164 ispunct(c)
165         int c;
166 {
167         return (__istype((c), _CTYPE_P));
168 }
169
170 #undef isrune
171 int
172 isrune(c)
173         int c;
174 {
175         return (__istype((c), 0xFFFFFF00L));
176 }
177
178 #undef isspace
179 int
180 isspace(c)
181         int c;
182 {
183         return (__istype((c), _CTYPE_S));
184 }
185
186 #undef isspecial
187 int
188 isspecial(c)
189         int c;
190 {
191         return (__istype((c), _CTYPE_T));
192 }
193
194 #undef isupper
195 int
196 isupper(c)
197         int c;
198 {
199         return (__istype((c), _CTYPE_U));
200 }
201
202 #undef isxdigit
203 int
204 isxdigit(c)
205         int c;
206 {
207         return (__isctype((c), _CTYPE_X));
208 }
209
210 #undef toascii
211 int
212 toascii(c)
213         int c;
214 {
215         return ((c) & 0x7F);
216 }
217
218 #undef tolower
219 int
220 tolower(c)
221         int c;
222 {
223         return (__tolower(c));
224 }
225
226 #undef toupper
227 int
228 toupper(c)
229         int c;
230 {
231         return (__toupper(c));
232 }
233