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