11573Srgrimes/*
21573Srgrimes * Copyright (c) 1989, 1993
31573Srgrimes *	The Regents of the University of California.  All rights reserved.
41573Srgrimes * (c) UNIX System Laboratories, Inc.
51573Srgrimes * All or some portions of this file are derived from material licensed
61573Srgrimes * to the University of California by American Telephone and Telegraph
71573Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81573Srgrimes * the permission of UNIX System Laboratories, Inc.
91573Srgrimes *
101573Srgrimes * This code is derived from software contributed to Berkeley by
111573Srgrimes * Paul Borman at Krystal Technologies.
121573Srgrimes *
131573Srgrimes * Redistribution and use in source and binary forms, with or without
141573Srgrimes * modification, are permitted provided that the following conditions
151573Srgrimes * are met:
161573Srgrimes * 1. Redistributions of source code must retain the above copyright
171573Srgrimes *    notice, this list of conditions and the following disclaimer.
181573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
191573Srgrimes *    notice, this list of conditions and the following disclaimer in the
201573Srgrimes *    documentation and/or other materials provided with the distribution.
211573Srgrimes * 4. Neither the name of the University nor the names of its contributors
221573Srgrimes *    may be used to endorse or promote products derived from this software
231573Srgrimes *    without specific prior written permission.
241573Srgrimes *
251573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
261573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
271573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
281573Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
291573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
301573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
311573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
321573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
331573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
341573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
351573Srgrimes * SUCH DAMAGE.
361573Srgrimes */
371573Srgrimes
381573Srgrimes#if defined(LIBC_SCCS) && !defined(lint)
391573Srgrimesstatic char sccsid[] = "@(#)isctype.c	8.3 (Berkeley) 2/24/94";
401573Srgrimes#endif /* LIBC_SCCS and not lint */
4192986Sobrien#include <sys/cdefs.h>
4292986Sobrien__FBSDID("$FreeBSD$");
431573Srgrimes
441573Srgrimes#include <ctype.h>
451573Srgrimes
4654746Sphantom#undef digittoint
4754746Sphantomint
4854746Sphantomdigittoint(c)
4954746Sphantom	int c;
5054746Sphantom{
51172619Sache	return (__sbmaskrune(c, 0xFF));
5254746Sphantom}
5354746Sphantom
541573Srgrimes#undef isalnum
551573Srgrimesint
561573Srgrimesisalnum(c)
571573Srgrimes	int c;
581573Srgrimes{
59172619Sache	return (__sbistype(c, _CTYPE_A|_CTYPE_D));
601573Srgrimes}
611573Srgrimes
621573Srgrimes#undef isalpha
631573Srgrimesint
641573Srgrimesisalpha(c)
651573Srgrimes	int c;
661573Srgrimes{
67172619Sache	return (__sbistype(c, _CTYPE_A));
681573Srgrimes}
691573Srgrimes
701573Srgrimes#undef isascii
711573Srgrimesint
721573Srgrimesisascii(c)
731573Srgrimes	int c;
741573Srgrimes{
75102030Sache	return ((c & ~0x7F) == 0);
761573Srgrimes}
771573Srgrimes
781573Srgrimes#undef isblank
791573Srgrimesint
801573Srgrimesisblank(c)
811573Srgrimes	int c;
821573Srgrimes{
83172619Sache	return (__sbistype(c, _CTYPE_B));
841573Srgrimes}
851573Srgrimes
861573Srgrimes#undef iscntrl
871573Srgrimesint
881573Srgrimesiscntrl(c)
891573Srgrimes	int c;
901573Srgrimes{
91172619Sache	return (__sbistype(c, _CTYPE_C));
921573Srgrimes}
931573Srgrimes
941573Srgrimes#undef isdigit
951573Srgrimesint
961573Srgrimesisdigit(c)
971573Srgrimes	int c;
981573Srgrimes{
99102030Sache	return (__isctype(c, _CTYPE_D));
1001573Srgrimes}
1011573Srgrimes
1021573Srgrimes#undef isgraph
1031573Srgrimesint
1041573Srgrimesisgraph(c)
1051573Srgrimes	int c;
1061573Srgrimes{
107172619Sache	return (__sbistype(c, _CTYPE_G));
1081573Srgrimes}
1091573Srgrimes
11054746Sphantom#undef ishexnumber
11154746Sphantomint
11254746Sphantomishexnumber(c)
11354746Sphantom	int c;
11454746Sphantom{
115172619Sache	return (__sbistype(c, _CTYPE_X));
11654746Sphantom}
11754746Sphantom
11854746Sphantom#undef isideogram
11954746Sphantomint
12054746Sphantomisideogram(c)
12154746Sphantom	int c;
12254746Sphantom{
123172619Sache	return (__sbistype(c, _CTYPE_I));
12454746Sphantom}
12554746Sphantom
1261573Srgrimes#undef islower
1271573Srgrimesint
1281573Srgrimesislower(c)
1291573Srgrimes	int c;
1301573Srgrimes{
131172619Sache	return (__sbistype(c, _CTYPE_L));
1321573Srgrimes}
1331573Srgrimes
13454746Sphantom#undef isnumber
13554746Sphantomint
13654746Sphantomisnumber(c)
13754746Sphantom	int c;
13854746Sphantom{
139172619Sache	return (__sbistype(c, _CTYPE_D));
14054746Sphantom}
14154746Sphantom
14254746Sphantom#undef isphonogram
14354746Sphantomint
14454746Sphantomisphonogram(c)
14554746Sphantom	int c;
14654746Sphantom{
147172619Sache	return (__sbistype(c, _CTYPE_Q));
14854746Sphantom}
14954746Sphantom
1501573Srgrimes#undef isprint
1511573Srgrimesint
1521573Srgrimesisprint(c)
1531573Srgrimes	int c;
1541573Srgrimes{
155172619Sache	return (__sbistype(c, _CTYPE_R));
1561573Srgrimes}
1571573Srgrimes
1581573Srgrimes#undef ispunct
1591573Srgrimesint
1601573Srgrimesispunct(c)
1611573Srgrimes	int c;
1621573Srgrimes{
163172619Sache	return (__sbistype(c, _CTYPE_P));
1641573Srgrimes}
1651573Srgrimes
16654746Sphantom#undef isrune
16754746Sphantomint
16854746Sphantomisrune(c)
16954746Sphantom	int c;
17054746Sphantom{
171172619Sache	return (__sbistype(c, 0xFFFFFF00L));
17254746Sphantom}
17354746Sphantom
1741573Srgrimes#undef isspace
1751573Srgrimesint
1761573Srgrimesisspace(c)
1771573Srgrimes	int c;
1781573Srgrimes{
179172619Sache	return (__sbistype(c, _CTYPE_S));
1801573Srgrimes}
1811573Srgrimes
18254746Sphantom#undef isspecial
18354746Sphantomint
18454746Sphantomisspecial(c)
18554746Sphantom	int c;
18654746Sphantom{
187172619Sache	return (__sbistype(c, _CTYPE_T));
18854746Sphantom}
18954746Sphantom
1901573Srgrimes#undef isupper
1911573Srgrimesint
1921573Srgrimesisupper(c)
1931573Srgrimes	int c;
1941573Srgrimes{
195172619Sache	return (__sbistype(c, _CTYPE_U));
1961573Srgrimes}
1971573Srgrimes
1981573Srgrimes#undef isxdigit
1991573Srgrimesint
2001573Srgrimesisxdigit(c)
2011573Srgrimes	int c;
2021573Srgrimes{
203102030Sache	return (__isctype(c, _CTYPE_X));
2041573Srgrimes}
2051573Srgrimes
2061573Srgrimes#undef toascii
2071573Srgrimesint
2081573Srgrimestoascii(c)
2091573Srgrimes	int c;
2101573Srgrimes{
211102030Sache	return (c & 0x7F);
2121573Srgrimes}
2131573Srgrimes
2141573Srgrimes#undef tolower
2151573Srgrimesint
2161573Srgrimestolower(c)
2171573Srgrimes	int c;
2181573Srgrimes{
219172619Sache	return (__sbtolower(c));
2201573Srgrimes}
2211573Srgrimes
2221573Srgrimes#undef toupper
2231573Srgrimesint
2241573Srgrimestoupper(c)
2251573Srgrimes	int c;
2261573Srgrimes{
227172619Sache	return (__sbtoupper(c));
2281573Srgrimes}
22929818Sjulian
230