167761Smsmith/* 267761Smsmith * Copyright (c) 1989, 1993 367761Smsmith * The Regents of the University of California. All rights reserved. 467761Smsmith * (c) UNIX System Laboratories, Inc. 567761Smsmith * All or some portions of this file are derived from material licensed 667761Smsmith * to the University of California by American Telephone and Telegraph 767761Smsmith * Co. or Unix System Laboratories, Inc. and are reproduced herein with 867761Smsmith * the permission of UNIX System Laboratories, Inc. 967761Smsmith * 1067761Smsmith * This code is derived from software contributed to Berkeley by 1167761Smsmith * Paul Borman at Krystal Technologies. 1267761Smsmith * 1367761Smsmith * Redistribution and use in source and binary forms, with or without 1467761Smsmith * modification, are permitted provided that the following conditions 1567761Smsmith * are met: 1667761Smsmith * 1. Redistributions of source code must retain the above copyright 1767761Smsmith * notice, this list of conditions and the following disclaimer. 1867761Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1967761Smsmith * notice, this list of conditions and the following disclaimer in the 2067761Smsmith * documentation and/or other materials provided with the distribution. 2167761Smsmith * 4. Neither the name of the University nor the names of its contributors 2267761Smsmith * may be used to endorse or promote products derived from this software 2367761Smsmith * without specific prior written permission. 2467761Smsmith * 2567761Smsmith * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2667761Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2767761Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2867761Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2967761Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3067761Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3167761Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3267761Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3367761Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3467761Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3567761Smsmith * SUCH DAMAGE. 3674914Sjhb */ 3769910Siwasaki 3874914Sjhb#if defined(LIBC_SCCS) && !defined(lint) 3967761Smsmithstatic char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 2/24/94"; 4067761Smsmith#endif /* LIBC_SCCS and not lint */ 4167761Smsmith#include <sys/cdefs.h> 4267761Smsmith__FBSDID("$FreeBSD$"); 4367761Smsmith 4469744Smsmith#include <ctype.h> 4569744Smsmith 4669744Smsmith#undef digittoint 4777432Smsmithint 4869744Smsmithdigittoint(int c) 4969744Smsmith{ 5067761Smsmith return (__sbmaskrune(c, 0xFF)); 5167761Smsmith} 5267761Smsmith 5367761Smsmith#undef isalnum 5467761Smsmithint 5567761Smsmithisalnum(int c) 5667761Smsmith{ 5767761Smsmith return (__sbistype(c, _CTYPE_A|_CTYPE_N)); 5867761Smsmith} 5967761Smsmith 6067761Smsmith#undef isalpha 6167761Smsmithint 6267761Smsmithisalpha(int c) 6367761Smsmith{ 6467761Smsmith return (__sbistype(c, _CTYPE_A)); 6567761Smsmith} 6667761Smsmith 6767761Smsmith#undef isascii 6867761Smsmithint 6967761Smsmithisascii(int c) 7067761Smsmith{ 7167761Smsmith return ((c & ~0x7F) == 0); 7267761Smsmith} 7367761Smsmith 7467761Smsmith#undef isblank 7567761Smsmithint 7667761Smsmithisblank(int c) 7767761Smsmith{ 7867761Smsmith return (__sbistype(c, _CTYPE_B)); 7967761Smsmith} 8067761Smsmith 8167761Smsmith#undef iscntrl 8269744Smsmithint 8367761Smsmithiscntrl(int c) 8467761Smsmith{ 8567761Smsmith return (__sbistype(c, _CTYPE_C)); 8667761Smsmith} 8767761Smsmith 8867761Smsmith#undef isdigit 8967761Smsmithint 9067761Smsmithisdigit(int c) 9167761Smsmith{ 9267761Smsmith return (__isctype(c, _CTYPE_D)); 9367761Smsmith} 9467761Smsmith 9577432Smsmith#undef isgraph 9669744Smsmithint 9767761Smsmithisgraph(int c) 9867761Smsmith{ 9967761Smsmith return (__sbistype(c, _CTYPE_G)); 10067761Smsmith} 10167761Smsmith 10267761Smsmith#undef ishexnumber 10367761Smsmithint 10467761Smsmithishexnumber(int c) 10569744Smsmith{ 10667761Smsmith return (__sbistype(c, _CTYPE_X)); 10767761Smsmith} 10867761Smsmith 10967761Smsmith#undef isideogram 11067761Smsmithint 11167761Smsmithisideogram(int c) 11267761Smsmith{ 11367761Smsmith return (__sbistype(c, _CTYPE_I)); 11477432Smsmith} 11569744Smsmith 11667761Smsmith#undef islower 11767761Smsmithint 11867761Smsmithislower(int c) 11971872Smsmith{ 12067761Smsmith return (__sbistype(c, _CTYPE_L)); 12167761Smsmith} 12267761Smsmith 12371872Smsmith#undef isnumber 12469744Smsmithint 12567761Smsmithisnumber(int c) 12667761Smsmith{ 12767761Smsmith return (__sbistype(c, _CTYPE_N)); 12867761Smsmith} 12969744Smsmith 13067761Smsmith#undef isphonogram 13167761Smsmithint 13267761Smsmithisphonogram(int c) 13367761Smsmith{ 13467761Smsmith return (__sbistype(c, _CTYPE_Q)); 13567761Smsmith} 13667761Smsmith 13769744Smsmith#undef isprint 13869744Smsmithint 13967761Smsmithisprint(int c) 14067761Smsmith{ 14167761Smsmith return (__sbistype(c, _CTYPE_R)); 14267761Smsmith} 14367761Smsmith 14467761Smsmith#undef ispunct 14567761Smsmithint 14667761Smsmithispunct(int c) 14767761Smsmith{ 14867761Smsmith return (__sbistype(c, _CTYPE_P)); 14977432Smsmith} 15069744Smsmith 15167761Smsmith#undef isrune 15267761Smsmithint 15367761Smsmithisrune(int c) 15467761Smsmith{ 15567761Smsmith return (__sbistype(c, 0xFFFFFF00L)); 15669744Smsmith} 15767761Smsmith 15869744Smsmith#undef isspace 15967761Smsmithint 16067761Smsmithisspace(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