1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * This code is derived from software contributed to Berkeley by
13 * Paul Borman at Krystal Technologies.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 *    notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 *    notice, this list of conditions and the following disclaimer in the
22 *    documentation and/or other materials provided with the distribution.
23 * 3. Neither the name of the University nor the names of its contributors
24 *    may be used to endorse or promote products derived from this software
25 *    without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 */
39
40#include <wctype.h>
41
42#undef iswalnum
43int
44iswalnum(wint_t wc)
45{
46	return (__istype(wc, _CTYPE_A|_CTYPE_N));
47}
48
49#undef iswalpha
50int
51iswalpha(wint_t wc)
52{
53	return (__istype(wc, _CTYPE_A));
54}
55
56#undef iswascii
57int
58iswascii(wint_t wc)
59{
60	return ((wc & ~0x7F) == 0);
61}
62
63#undef iswblank
64int
65iswblank(wint_t wc)
66{
67	return (__istype(wc, _CTYPE_B));
68}
69
70#undef iswcntrl
71int
72iswcntrl(wint_t wc)
73{
74	return (__istype(wc, _CTYPE_C));
75}
76
77#undef iswdigit
78int
79iswdigit(wint_t wc)
80{
81	return (__istype(wc, _CTYPE_D));
82}
83
84#undef iswgraph
85int
86iswgraph(wint_t wc)
87{
88	return (__istype(wc, _CTYPE_G));
89}
90
91#undef iswhexnumber
92int
93iswhexnumber(wint_t wc)
94{
95	return (__istype(wc, _CTYPE_X));
96}
97
98#undef iswideogram
99int
100iswideogram(wint_t wc)
101{
102	return (__istype(wc, _CTYPE_I));
103}
104
105#undef iswlower
106int
107iswlower(wint_t wc)
108{
109	return (__istype(wc, _CTYPE_L));
110}
111
112#undef iswnumber
113int
114iswnumber(wint_t wc)
115{
116	return (__istype(wc, _CTYPE_N));
117}
118
119#undef iswphonogram
120int
121iswphonogram(wint_t wc)
122{
123	return (__istype(wc, _CTYPE_Q));
124}
125
126#undef iswprint
127int
128iswprint(wint_t wc)
129{
130	return (__istype(wc, _CTYPE_R));
131}
132
133#undef iswpunct
134int
135iswpunct(wint_t wc)
136{
137	return (__istype(wc, _CTYPE_P));
138}
139
140#undef iswrune
141int
142iswrune(wint_t wc)
143{
144	return (__istype(wc, 0xFFFFFF00L));
145}
146
147#undef iswspace
148int
149iswspace(wint_t wc)
150{
151	return (__istype(wc, _CTYPE_S));
152}
153
154#undef iswspecial
155int
156iswspecial(wint_t wc)
157{
158	return (__istype(wc, _CTYPE_T));
159}
160
161#undef iswupper
162int
163iswupper(wint_t wc)
164{
165	return (__istype(wc, _CTYPE_U));
166}
167
168#undef iswxdigit
169int
170iswxdigit(wint_t wc)
171{
172	return (__istype(wc, _CTYPE_X));
173}
174
175#undef towlower
176wint_t
177towlower(wint_t wc)
178{
179        return (__tolower(wc));
180}
181
182#undef towupper
183wint_t
184towupper(wint_t wc)
185{
186        return (__toupper(wc));
187}
188
189