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