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 * %sccs.include.redist.c%
14 */
15
16 #if defined(LIBC_SCCS) && !defined(lint)
17 static char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 02/24/94";
18 #endif /* LIBC_SCCS and not lint */
19
20 #define _ANSI_LIBRARY
21 #include <ctype.h>
22
23 #undef isalnum
24 int
isalnum(c)25 isalnum(c)
26 int c;
27 {
28 return(__istype((c), (_A|_D)));
29 }
30
31 #undef isalpha
32 int
isalpha(c)33 isalpha(c)
34 int c;
35 {
36 return (__istype((c), _A));
37 }
38
39 #undef isascii
40 int
isascii(c)41 isascii(c)
42 int c;
43 {
44 return((c & ~0x7F) == 0);
45 }
46
47 #undef isblank
48 int
isblank(c)49 isblank(c)
50 int c;
51 {
52 return (__istype((c), _B));
53 }
54
55 #undef iscntrl
56 int
iscntrl(c)57 iscntrl(c)
58 int c;
59 {
60 return (__istype((c), _C));
61 }
62
63 #undef isdigit
64 int
isdigit(c)65 isdigit(c)
66 int c;
67 {
68 return (__isctype((c), _D));
69 }
70
71 #undef isgraph
72 int
isgraph(c)73 isgraph(c)
74 int c;
75 {
76 return (__istype((c), _G));
77 }
78
79 #undef islower
80 int
islower(c)81 islower(c)
82 int c;
83 {
84 return (__istype((c), _L));
85 }
86
87 #undef isprint
88 int
isprint(c)89 isprint(c)
90 int c;
91 {
92 return (__istype((c), _R));
93 }
94
95 #undef ispunct
96 int
ispunct(c)97 ispunct(c)
98 int c;
99 {
100 return (__istype((c), _P));
101 }
102
103 #undef isspace
104 int
isspace(c)105 isspace(c)
106 int c;
107 {
108 return (__istype((c), _S));
109 }
110
111 #undef isupper
112 int
isupper(c)113 isupper(c)
114 int c;
115 {
116 return (__istype((c), _U));
117 }
118
119 #undef isxdigit
120 int
isxdigit(c)121 isxdigit(c)
122 int c;
123 {
124 return (__isctype((c), _X));
125 }
126
127 #undef toascii
128 int
toascii(c)129 toascii(c)
130 int c;
131 {
132 return (c & 0177);
133 }
134
135 #undef tolower
136 int
tolower(c)137 tolower(c)
138 int c;
139 {
140 return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
141 }
142
143 #undef toupper
144 int
toupper(c)145 toupper(c)
146 int c;
147 {
148 return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
149 }
150